当设备和模拟器未连接到 Xcode 时,Core Data 崩溃
当连接到 Xcode 时,我的应用程序可以在设备和模拟器中运行。否则它会在此时崩溃(在没有 Xcode 的情况下运行时在两个设备/模拟器上)。一定是调试器让它保持活动状态或者什么的。我认为崩溃来自:
CDObject * cdObject = [NSEntityDescription insertNewObjectForEntityForName:@"CDObject" inManagedObjectContext:self.moc];
我在程序的其他地方使用了核心数据,并且它工作正常。 我已经通过 NSLog 语句验证 self.moc 不为零。这是崩溃报告的一部分..
Date/Time: 2011-12-06 10:19:39.146 -0500
OS Version: iPhone OS 5.0 (9A334)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x3d6936a8
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x362b6fca objc_msgSend + 30
1 CoreFoundation 0x374276ea CFDictionarySetValue + 102
2 CoreData 0x317082ec _PFCMT_SetValue + 852
3 CoreData 0x31769b90 -[NSManagedObjectContext(_NSInternalAdditions) _insertObjectWithGlobalID:globalID:] + 60
4 CoreData 0x31760aba -[NSManagedObjectContext insertObject:] + 134
5 CoreData 0x31707d56 -[NSManagedObject initWithEntity:insertIntoManagedObjectContext:] + 538
6 CoreData 0x3173f5ce +[NSEntityDescription insertNewObjectForEntityForName:inManagedObjectContext:] + 174
My app runs on both the device and in simulator when connected to Xcode. Other wise it crashes at this point (On both device / simulator when run without Xcode). Must be the debugger keeping it alive or something. I think the crash is coming from:
CDObject * cdObject = [NSEntityDescription insertNewObjectForEntityForName:@"CDObject" inManagedObjectContext:self.moc];
I use Core Data else where in the program and it is working fine.
I've verified that the self.moc is not nil through NSLog statements. Here is part of the crash report..
Date/Time: 2011-12-06 10:19:39.146 -0500
OS Version: iPhone OS 5.0 (9A334)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x3d6936a8
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x362b6fca objc_msgSend + 30
1 CoreFoundation 0x374276ea CFDictionarySetValue + 102
2 CoreData 0x317082ec _PFCMT_SetValue + 852
3 CoreData 0x31769b90 -[NSManagedObjectContext(_NSInternalAdditions) _insertObjectWithGlobalID:globalID:] + 60
4 CoreData 0x31760aba -[NSManagedObjectContext insertObject:] + 134
5 CoreData 0x31707d56 -[NSManagedObject initWithEntity:insertIntoManagedObjectContext:] + 538
6 CoreData 0x3173f5ce +[NSEntityDescription insertNewObjectForEntityForName:inManagedObjectContext:] + 174
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论