Created
April 3, 2013 02:22
-
-
Save alattis/5297950 to your computer and use it in GitHub Desktop.
thread safe core data the easy way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//in background operation | |
backgroundMOC = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType]; | |
[backgroundMOC setParentContext:appDelegate.managedObjectContext]; | |
//in app delegate | |
if (coordinator != nil) { | |
_managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType]; | |
[_managedObjectContext setPersistentStoreCoordinator:coordinator]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment