*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 18 beyond bounds [0 .. 16]'
*** Call stack at first throw:
(
0 CoreFoundation 0x02b11b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02c6140e objc_exception_throw + 47
2 CoreFoundation 0x02b07695 -[__NSArrayM objectAtIndex:] + 261
3 MyPocket 0x0005efe9 -[loginLocalitems tableView:didSelectRowAtIndexPath:] + 638
4 UIKit 0x00be9a48 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
5 UIKit 0x00be032e -[UITableView _userSelectRowAtIndexPath:] + 219
6 Foundation 0x0037821a __NSFireDelayedPerform + 441
7 CoreFoundation 0x02af2f73 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
8 CoreFoundation 0x02af45b4 __CFRunLoopDoTimer + 1364
9 CoreFoundation 0x02a50dd9 __CFRunLoopRun + 1817
10 CoreFoundation 0x02a50350 CFRunLoopRunSpecific + 208
11 CoreFoundation 0x02a50271 CFRunLoopRunInMode + 97
12 GraphicsServices 0x03f4e00c GSEventRunModal + 217
13 GraphicsServices 0x03f4e0d1 GSEventRun + 115
14 UIKit 0x00b84af2 UIApplicationMain + 1160
15 MyPocket 0x000023d2 main + 84
16 MyPocket 0x00002375 start + 53
17 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
上述阵列的原因是什么?仅当我选择表格视图的下方单元格时才会出现此崩溃任何人请帮助
答案 0 :(得分:3)
此错误告诉您NSMutableArray内部只有0到16个对象。当您滚动到表格的底部并选择较低的单元格时,您试图访问数组中的索引高于16的对象。因此,请尝试检查您用于表格的数组是否已正确填充,以及你不会在以后删除它。
答案 1 :(得分:3)
这是范围例外:
index 18 beyond bounds [0 .. 16]
如您所见,只有在您点击较低的项目
时才会发生