Created
October 22, 2011 17:48
-
-
Save mikeabdullah/1306274 to your computer and use it in GitHub Desktop.
Forcing true reset of managed object context
This file contains hidden or 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
- (BOOL)hardResetContext:(NSManagedObjectContext *)context store:(NSPersistentStore *)store; | |
{ | |
NSPersistentStoreCoordinator *storeCoordinator = [context persistentStoreCoordinator]; | |
if (![storeCoordinator removePersistentStore:myStore error:NULL]) | |
{ | |
return NO; | |
} | |
return [storeCoordinator addPersistentStoreWithType:[store type] | |
configuration:nil | |
URL:[store URL] | |
options:nil | |
error:NULL]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What will happen if you have strong reference to managed objects ?