我正在通过我的应用程序中的崩溃报告遇到神秘的Core Data崩溃,我很难想出一个理论。没有复制步骤,没有明显的原因,但它发生了数千次。崩溃报告非常模糊,但是当NSManagedObject
通过属性分配给另一个时,似乎会发生这种情况?任何理论都会受到赞赏。
*** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault for '0x1dc92160 <x-coredata://6903F7F9-C600-4A29-A538-B3337F1D0BED/Profile/p47854>''
Last Exception Backtrace:
1 CoreFoundation __exceptionPreprocess + 163
2 libobjc.A.dylib objc_exception_throw + 30
3 CoreData _PFFaultHandlerLookupRow + 1477
4 CoreData _PF_FulfillDeferredFault + 203
5 CoreData _PF_ManagedObject_WillChangeValueForKeywithSetMutation + 71
6 CoreData -[NSManagedObject willChangeValueForKey:withSetMutation:usingObjects:] + 84
7 CoreData -[NSManagedObject _includeObject:intoPropertyWithKey:andIndex:] + 690
8 CoreData -[NSManagedObject _maintainInverseRelationship:forProperty:oldDestination:newDestination:] + 444
9 CoreData -[NSManagedObject _didChangeValue:forRelationship:named:withInverse:] + 1290
10 CoreData -[NSManagedObjectContext observeValueForKeyPath:ofObject:change:context:] + 322
11 Foundation NSKeyValueNotifyObserver + 273
12 Foundation NSKeyValueDidChange + 335
13 Foundation -[NSObject didChangeValueForKey:] + 94
14 CoreData -[NSManagedObject didChangeValueForKey:] + 126
15 CoreData -[NSManagedObject _updateFromRefreshSnapshot:includingTransients:] + 614
16 CoreData -[NSManagedObjectContext _copyChildObject:toParentObject:fromChildContext:] + 96
17 CoreData -[NSManagedObjectContext _parentProcessSaveRequest:inContext:error:] + 554
18 CoreData __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke_0 + 565
19 libdispatch.dylib _dispatch_barrier_sync_f_slow_invoke + 81
20 libdispatch.dylib _dispatch_client_callout + 23
21 libdispatch.dylib _dispatch_main_queue_callback_4CF$VARIANT$up + 227
22 CoreFoundation __CFRunLoopRun + 1291
23 CoreFoundation CFRunLoopRunSpecific + 356
24 CoreFoundation CFRunLoopRunInMode + 104
25 GraphicsServices GSEventRunModal + 74
26 UIKit UIApplicationMain + 1120
27 My App main (main.m:18)
28 libdyld.dylib start + 0
答案 0 :(得分:1)
“CoreData无法完成故障”通常在使用一个上下文从持久性存储中删除某个对象时发生,但在另一个上下文中,此对象仍然存在,这是一个错误,并且您尝试访问它的某些属性。
不要忘记,由于关系的级联删除规则,可以删除对象。
以下是可能的时间表:
答案 1 :(得分:0)
如果已经在另一个线程或另一个ManagedObjectContext中删除了已经提取的对象,则在尝试访问已删除对象的属性时可能会收到异常。
这是由于此处描述的故障: https://developer.apple.com/library/ios/documentation/cocoa/conceptual/CoreData/Articles/cdFaultingUniquing.html