Reputation: 6666
I occasionally get this error when saving to core data. I cannot manage to recreate it.
Does anyone have any experience with this error;
CoreData: error: NULL _cd_rawData but the object is not being turned into a fault
?
Upvotes: 43
Views: 16362
Reputation: 1579
After going to several post, this had a better answer https://web.archive.org/web/20150215081345/http://www.cocoabuilder.com:80/archive/cocoa/311615-weird-core-data-crash.html
Upvotes: 14
Reputation: 10954
This happens when the object's context does not belong to the current thread. One of many ways that mistake can manifest itself.
When the crash occurs do the following:
NSManagedObjectContext
mainQueueConcurrencyType
then it needs to be on the main thread otherwise on the background threads.p context.concurrencyType
In the sample command above the NSManagedObjectContext
was stored in the variable context
(NSManagedObjectContextConcurrencyType) $R4 = mainQueueConcurrencyType
Upvotes: 58
Reputation: 2221
I found the same problem when I tried to read (access) data from a Coredata Store in other thread (not main).
You can solve this problem by following this suggestion from this link:
Core Data and threads / Grand Central Dispatch
Upvotes: 1