Skip to content

Instantly share code, notes, and snippets.

@orkenstein
Last active August 29, 2015 14:04
Show Gist options
  • Save orkenstein/e84f79b5f9438250328b to your computer and use it in GitHub Desktop.
Save orkenstein/e84f79b5f9438250328b to your computer and use it in GitHub Desktop.
Core Data Stack init example
// 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