Iphone tableview单元格中的崩溃
出现上述阵列的原因是什么。此崩溃仅在我选择“表视图”的下部单元格时出现。请提供帮助。此错误告诉您NSMutableArray中只有0到16个对象。当您滚动到表格底部并选择较低的单元格时,您正试图访问索引高于16的数组中的对象。因此,请尝试检查您用于表的数组是否已正确填充,以及您以后是否没有从中删除某些内容。此错误告诉您NSMutableArray中只有0到16个对象。当您滚动到表格底部并选择较低的单元格时,您正试图访问索引高于16的数组中的对象。因此,请尝试检查您用于表的数组是否已正确填充,并且您以后没有从中删除任何内容。您是从可变数组加载数据吗? 检查数组是否真的有18个元素。 或者,如果在numberOfRows方法中给出的数字大于实际行数 这是一个范围异常:Iphone tableview单元格中的崩溃,iphone,ios4,iphone-sdk-3.0,cocos2d-iphone,ios-simulator,Iphone,Ios4,Iphone Sdk 3.0,Cocos2d Iphone,Ios Simulator,出现上述阵列的原因是什么。此崩溃仅在我选择“表视图”的下部单元格时出现。请提供帮助。此错误告诉您NSMutableArray中只有0到16个对象。当您滚动到表格底部并选择较低的单元格时,您正试图访问索引高于16的数组中的对象。因此,请尝试检查您用于表的数组是否已正确填充,以及您以后是否没有从中删除某些内容。此错误告诉您NSMutableArray中只有0到16个对象。当您滚动到表格底部并选择较低的单元格时,您正试图访问索引高于16的数组中的对象。因此,请尝试检查您用于表的数组是否已正确填充,并且
*** 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'
如您所见,仅当您单击下面的项目时才会发生此错误。您正在从可变数组加载数据吗? 检查数组是否真的有18个元素。 或者,如果在numberOfRows方法中给出的数字大于实际行数 这是一个范围异常:
*** 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'
如您所见,仅当您单击下面的项目时才会发生这种情况从
didSelectRowAtIndexPath:
从didSelectRowAtIndexPath:
Post您的代码