magicalrecord   51

« earlier    

ios - Magical Record with concurrency - Stack Overflow
Side not about child contexts

Also take a peek to child contexts. They can be powerful too. Basically every child context sends it's changes to parent context on save (in case of "base" context (no parent context), it sends it's changes to persistent coordinator).

For example when you are creating edit/add controller you can create child context from your main context and perform all changes in it. When user decides to cancel the operation, you just destroy (remove reference) the child context and no changes will be stored. If user decides to accept changes he/she made, save the child context and destroy it. By saving child context all changes are propagated to it's parent store (in this example your main context). Just be sure to also save the parent context (at some point) to persist these changes (save: method doesn't do the bubbling). Checkout documentation of managing parent store.
coredata  magicalrecord 
november 2015 by klauslanza
ios - Magical Record, multiple configurations and Restkit - Stack Overflow
NSManagedObjectModel * model = [NSManagedObjectModel MR_defaultManagedObjectModel];

NSURL *seedURL = [NSPersistentStore MR_urlForStoreName:[seedStoreName stringByAppendingString:@".sqlite"]];

NSPersistentStoreCoordinator * coordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model];

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption,
nil];

NSPersistentStore * seedStore =[coordinator
addPersistentStoreWithType:NSSQLiteStoreType
configuration:@"Seed"
URL:seedURL
options:options
error:&error];
if (!seedStore || error)
{
NSLog(@"Error setting up seed store:%@ for %@", [error localizedDescription], seedURL);
exit(-1);
}
coredata  magicalrecord 
november 2015 by klauslanza
ios - MagicalRecord: multiple databases - Stack Overflow
NSManagedObjectModel * model = [NSManagedObjectModel MR_defaultManagedObjectModel];

NSURL *seedURL = [NSPersistentStore MR_urlForStoreName:[seedStoreName stringByAppendingString:@".sqlite"]];

NSPersistentStoreCoordinator * coordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model];

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption,
nil];

NSPersistentStore * seedStore =[coordinator
addPersistentStoreWithType:NSSQLiteStoreType
configuration:@"Seed"
URL:seedURL
options:options
error:&error];
if (!seedStore || error)
{
NSLog(@"Error setting up seed store:%@ for %@", [error localizedDescription], seedURL);
exit(-1);
}

NSURL *userURL = [NSPersistentStore MR_urlForStoreName:[userStoreName stringByAppendingString:@".sqlite"]];

NSPersistentStore * userStore = [coordinator
addPersistentStoreWithType:NSSQLiteStoreType
configuration:@"User"
URL:userURL
options:options
error:&error];

if (!userStore || error)
{
NSLog(@"Error setting up user store:%@ for %@", [error localizedDescription], userURL);
exit (-1);
}
[NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator];

[NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator];
coredata  magicalrecord 
november 2015 by klauslanza
Getting Started with MagicalRecord
Core Data is Apple’s built-in solution for the persistence and querying of user data in your OS X and iOS apps. Although Apple constantly tinkers with things to make it easier for developers to use, Core Data remains a challenging API to master.
Apple_iPhone_Development  Ray_Wenderlich  MagicalRecord 
september 2015 by GameGamer43

« earlier    

related tags

activerecord  afnetworkig  apple_iphone_development  ar  async  blocks  bug  cocoa  cocoapods  coding_practice  concurrency  core-data  core  core_data  coredata  data  database  db  debug  dev  develop  fetching  fix  gcd  girlfriend  github  googlereader  howto  ifttt  import  importing  ios  iosdev  iossdk  is  library  macosxdev  magicalimport  magicrecord  migration  mister  my  nsfetchedresultcontroller  nsmanagedobjectcontext  obejctivec  objc  objective-c  objectivec  opensource  orm  pattern  programming  ray_wenderlich  restkit  threads  tips  to-grok  to-read  tutorial  unittesting  wenderlich  xcode 

Copy this bookmark:



description:


tags: