Created
May 30, 2013 20:27
-
-
Save Rich86man/5680906 to your computer and use it in GitHub Desktop.
persistantStoreCoordinator
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
// Returns the persistent store coordinator for the application. | |
// If the coordinator doesn't already exist, it is created and the application's store added to it. | |
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator | |
{ | |
if (!_persistentStoreCoordinator) { | |
NSURL *storeURL = [[[NSFileManager defaultManager] applicationDocumentsDirectory] URLByAppendingPathComponent:@"UfoSightings.sqlite"]; | |
NSError *error = nil; | |
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]]; | |
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) { | |
NSLog(@"Unresolved error %@, %@", error, [error userInfo]); | |
abort(); | |
} | |
} | |
return _persistentStoreCoordinator; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment