Sometimes my app crashes when I want to update my Core Data file by downloading and parsing a json file. I get the following error:
CoreData: error: Serio
You shouldn't be accessing your managed object context on serialQueue
. Take a look at the Concurrency section of the NSManagedObjectContext documentation.
If in your code your context is using NSPrivateQueueConcurrencyType
or NSMainQueueConcurrencyType
concurrency type, you can use one of the block-based methods to ensure you're on the right queue:
//asyncrhonous
[self.managedObjectContext performBlock:^{
//do stuff with the context
}];
//syncrhonous
[self.managedObjectContext performBlockAndWait:^{
//do stuff with the context
}];