I am loading JSON in background thread and saving it in Core Data. 99.9% of times everything works, but occasionally I get a strange background crash, with this exception:
Object 0x7b14001efcd0 which is being asked for objectID it really is a string, it's actually the NSManagedObjectID:
Is this maybe a bug in Core Data or is there something I can do to fix this? Not a single line in my code is present in thread stack list.
Code Block -[NSCFString objectID]: unrecognized selector sent to instance 0x7b14001efcd0 ( 0 CoreFoundation 0x00007fff2043a126 exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff20177f78 objc_exception_throw + 48 2 CoreFoundation 0x00007fff20448c6f +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0 3 CoreFoundation 0x00007fff2043e666 _forwarding_ + 1489 4 CoreFoundation 0x00007fff20440698 _CF_forwarding_prep_0 + 120 5 CoreData 0x00007fff251a034b -[NSManagedObjectContext _disposeObjects:count:notifyParent:] + 176 6 CoreData 0x00007fff25195b20 -[NSManagedObjectContext _dispose:] + 297 7 CoreData 0x00007fff2510f004 -[NSManagedObjectContext _dealloc] + 570 8 CoreData 0x00007fff251ac1be internalBlockToDeallocNSManagedObjectContext_block_invoke + 43 9 CoreData 0x00007fff25109933 developerSubmittedBlockToNSManagedObjectContextPerform + 154 10 libclang_rt.tsan_iossim_dynamic.dyl 0x00000001098f2c72 _ZN6__tsanL22dispatch_callback_wrapEPv + 306 11 libdispatch.dylib 0x00007fff20106534 _dispatch_client_callout + 8 12 libdispatch.dylib 0x00007fff2010c425 _dispatch_lane_serial_drain + 715 13 libdispatch.dylib 0x00007fff2010cfa0 _dispatch_lane_invoke + 403 14 libdispatch.dylib 0x00007fff20117591 _dispatch_workloop_worker_thread + 782 15 libsystem_pthread.dylib 0x00007fff5dcd8a3d _pthread_wqthread + 290 16 libsystem_pthread.dylib 0x00007fff5dcd7b77 start_wqthread + 15 )
Object 0x7b14001efcd0 which is being asked for objectID it really is a string, it's actually the NSManagedObjectID:
Code Block (lldb) po 0x7b14001efcd0 x-coredata://EA951A1D-C5F1-4CAA-80DA-D187C94817D4/Event/p101
Is this maybe a bug in Core Data or is there something I can do to fix this? Not a single line in my code is present in thread stack list.