问题
Good evening!
So I've been having some trouble understanding what the hell is going on while saving my data in Core Data. First of all, a quick question:
1) When should I be using the persistentStoreManagedObjectContext and when should I be using the mainQueueManagedObjectContext?! Right now, I always use the persistentManagedObjectContext, but I can see that a RestKit call "getObjectsPath", the object will have the mainQueueObjectContext. Why is that?!
Thanks!
回答1:
persistentStoreManagedObjectContext
could be used to populate other another NSManagedObjectContext (e.g. for a background thread).
So unless your not leaving the main thread when accessing the object, use the mainQueueManagedObjectContext
and you're on the safe site.
来源:https://stackoverflow.com/questions/15457290/persistentstoremanagedobjectcontext-vs-mainqueuemanagedobjectcontext