我想創建一個tableview跟着一個例子代碼放在一本書上,但它總是崩潰。 調試器給我看信息:如何修復由於未捕獲的異常'NSRangeException'導致tableview崩潰,原因:'*** - [__ NSArrayM objectAtIndex:]:索引1超越界限[0 .. 0]'
2012-08-03 02:51:09.854 TableView[652:c07] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(0x1794022 0x1194cd6 0x1780d88 0xfdd1b7 0x3b24 0x2e62 0xb2c54 0xb33ce 0x9ecbd 0xad6f1 0x56d21 0x1795e42 0x2065679 0x206f579 0x1ff44f7 0x1ff63f6 0x2083160 0x16e84 0x17767 0x26183 0x26c38 0x1a634 0x167eef5 0x1768195 0x16ccff2 0x16cb8da 0x16cad84 0x16cac9b 0x16c65 0x18626 0x1eb2 0x1e25)
terminate called throwing an exception(lldb)
我不知道這是什麼意思。對不起,長碼再次.... 如有必要,我可以發送整個代碼。
有人在網上說問題發生是由於plist,http://p2p.wrox.com/271591-post2.html ,但我不能修改Xcode 4中的plist。4.Xcode顯示綠色指針此代碼
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
NSManagedObject *object = [self.fetchedResultsController objectAtIndexPath:indexPath];
cell.textLabel.text = [[object valueForKey:@"timeStamp"] description];
}
你能減少你發佈的代碼量嗎?嘗試只發布相關的代碼崩潰發生在 – 2012-08-02 19:37:40
@DanF對不起,我是新的objective-c.Maybe這就是你想要的。 – kururu623 2012-08-02 20:08:13