ios – NSRangeException’,原因:’*** – [__ NSArrayM objectAtIndex:]:索引5超出空数组的边界’

ios – NSRangeException’,原因:’*** – [__ NSArrayM objectAtIndex:]:索引5超出空数组的边界’,第1张

概述在我的应用程序中,当我第一次运行应用程序时,它工作正常.但是当我再次运行2次,它崩溃了. 这是错误.. NSRangeException’,原因:’*** – [__ NSArrayM objectAtIndex:]:索引5超出空数组边界’ 原因:您正在访问要在索引处访问对象的Empty数组. 替换下面代码中的所有地方 [arrMydata objectAtIndex:indexPath.row 在我的应用程序中,当我第一次运行应用程序时,它工作正常.但是当我再次运行2次,它崩溃了.

这是错误..

NSRangeException’,原因:’*** – [__ NSArrayM objectAtIndex:]:索引5超出空数组的边界’

解决方法 原因:您正在访问要在索引处访问对象的Empty数组.

替换下面代码中的所有地方

[arrMydata objectAtIndex:indexPath.row];

//1. Positive index ([anArray objectAtIndex:-NUMBERS]) will crash //2. within the array boundary if([arrMydata count] > 0 && [arrMydata count] > indexPath.row){    shrObj=[arrMydata objectAtIndex:indexPath.row]; } else{    //Array is empty,handle as you needed }

**Here You can see the non software example,which will explain this issue. Good luck! **

总结

以上是内存溢出为你收集整理的ios – NSRangeException’,原因:’*** – [__ NSArrayM objectAtIndex:]:索引5超出空数组的边界’全部内容,希望文章能够帮你解决ios – NSRangeException’,原因:’*** – [__ NSArrayM objectAtIndex:]:索引5超出空数组的边界’所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1109684.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存