Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

persistentStoreManagedObjectContext vs mainQueueManagedObjectContext

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!

like image 411
abisson Avatar asked Mar 17 '13 03:03

abisson


1 Answers

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.

like image 170
flashfabrixx Avatar answered Nov 15 '22 07:11

flashfabrixx