Last active
August 29, 2015 14:04
-
-
Save orkenstein/e84f79b5f9438250328b to your computer and use it in GitHub Desktop.
Core Data Stack init example
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
// Setup iCloud stack | |
static NSString *const kICloudStoreName = @"iCloudStore.sqlite"; | |
static NSString *const kICloudContentNameKey = @"savefonmobiHabIt"; | |
[MagicalRecord setupCoreDataStackWithiCloudContainer:nil | |
contentNameKey:kICloudContentNameKey | |
localStoreNamed:kICloudStoreName | |
cloudStorePathComponent:nil | |
completion:^{ | |
// Notify | |
self.coreDataInitialised = YES; | |
[[NSNotificationCenter defaultCenter] | |
postNotificationName:HICoreDataStackInitNotification | |
object:self]; | |
self.lastICloudStoreURL = [[NSPersistentStore MR_defaultPersistentStore] URL]; | |
if (completion != nil) { | |
completion(); | |
} | |
}]; | |
// Setup usual stack | |
[MagicalRecord setupAutoMigratingCoreDataStack]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment