I have integrated iCloud into my application and I am able to save the iCloud changes successfully in my persistent store. Currently, I am doing the following :-
// my NSManagedObjectContext
(used by main thread) is declared as NSMainQueueConcurrencyType
- Listen for iCloud Notification
- Merge changes into the main managedObjectContext using
performBlock
I have also seen the following approach :-
// NSManagedObjectContext (used by main thread) is declared as NSMainQueueConcurrency
Type
- Create a temporary managed object context having
NSPrivateQueueConcurrency
type as its concurrency type in the method executed when iCloud sends notification - Make the main MOC as the parent of the temporary MOC
- Do save on temporary MOC (This will push changes to main MOC)
- Do save on main MOC using
performBlock
So, both approaches are using performBlock
to save the changes to the persistent store. So, is there any particular advantage / disadvantage to any approach ?