Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I attempted to use my own CoreData configuration with the new version of RestKit and ended up running into several issues with objects being accessed from different contexts and data inconsistency. Here is the code for my RestKit initialization:</p> <pre><code>NSError * error; NSURL * modelURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"CoreData" ofType:@"momd"]]; NSManagedObjectModel * managedObjectModel = [[[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL] mutableCopy]; RKManagedObjectStore * managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel]; [managedObjectStore createPersistentStoreCoordinator]; NSArray * searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString * documentPath = [searchPaths objectAtIndex:0]; NSPersistentStore * persistentStore = [managedObjectStore addSQLitePersistentStoreAtPath:[NSString stringWithFormat:@"%@/CoreData.sqlite", documentPath] fromSeedDatabaseAtPath:nil withConfiguration:nil options:nil error:&amp;error]; if(!persistentStore){ NSLog(@"Failed to add persistent store: %@", error); } [managedObjectStore createManagedObjectContexts]; [RKManagedObjectStore setDefaultStore:managedObjectStore]; _objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://localhost:3000/"]]; _objectManager.managedObjectStore = managedObjectStore; // Object Mapping Code... </code></pre> <p>From your context manager, you can access the generate context with <code>[RKObjectManager sharedManager].managedObjectStore.mainQueueManagedObjectContext</code> That should allow you to still make your CoreData queries with your manager.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload