我的iPhone游戏在设备上崩溃,我试图了解发生了什么。了解iPhone崩溃日志
每次用户退出游戏画面,它都会发送一条消息给HomePageController
(我的顶级控制器),告诉它保存用户数据。除了在这个特殊情况下,这一切都可以正常工作。抛出的异常似乎表明,HomePageController
没有识别出saveUserData
选择器,但我不明白这是如何发生的,因为该功能绝对在该控制器中,并且在其余时间内工作。
任何人都可以提供任何建议吗? 125
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x3756a88f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x35a70259 objc_exception_throw + 33
2 CoreFoundation 0x3756da9b -[NSObject doesNotRecognizeSelector:] + 175
3 CoreFoundation 0x3756c915 ___forwarding___ + 301
4 CoreFoundation 0x374c7650 _CF_forwarding_prep_0 + 48
5 P------k 0x0000ebe1 -[HomePageController saveUserData] (HomePageController.m:125)
6 P------k 0x00008a0b -[RootViewController viewDidAppear:] (RootViewController.m:102)
线在HomePageController.m:
- (void)saveUserData{
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES) objectAtIndex:0];
//10x10
{
NSMutableDictionary *dict = [[[NSMutableDictionary alloc] init] autorelease];
for (int i = 0; i < _puzzles10x10.count; i++){
LevelData *currentPuzzle = [_puzzles10x10 objectAtIndex:i];
/*(line 125)*/ [dict setObject:[currentPuzzle getPuzzleUserData] forKey:currentPuzzle.title];
}
[dict writeToFile:[documentsPath stringByAppendingPathComponent:@"userdata.dat"] atomically:YES];
}
// more here
}
你可以在你的HomePageController.m文件中发布什么是125行吗?我想你会在那里找到你的答案 – giorashc 2012-03-18 10:04:19
@giorashc啊,是的,现在看起来很明显..更新问题,仍然不完全确定为什么它在该行崩溃 – Chris 2012-03-18 10:07:04
RootViewController的102行也会很有趣= = – 2012-03-18 10:37:25