Note that there are some explanatory texts on larger screens.

plurals
  1. PORestKit - Not able to map Entity
    primarykey
    data
    text
    <p>I'm trying to map a CoreData Entity called <code>Product</code> with a web service.</p> <pre class="lang-c prettyprint-override"><code>NSString *objName = @"Product"; RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL: baseUrl]; NSManagedObjectContext *context = [[MContextManager sharedContextManager] managedObjectContext]; NSManagedObjectModel *managedObjectModel = [[context persistentStoreCoordinator] managedObjectModel]; RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel]; [managedObjectStore createPersistentStoreCoordinator]; [managedObjectStore createManagedObjectContexts]; objectManager.managedObjectStore = managedObjectStore; RKEntityMapping *objMap = [RKEntityMapping mappingForEntityForName:objName inManagedObjectStore:managedObjectStore]; [objMap addAttributeMappingsFromDictionary: @{ @"CODE": @"code", @"LABEL": @"label", }]; RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:objMap pathPattern:nil keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)]; [objectManager addResponseDescriptor:responseDescriptor]; [objectManager getObjectsAtPath:objName parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) { NSLog(@"ok"); } failure:^(RKObjectRequestOperation *operation, NSError *error) { NSLog(@"ko"); }]; return; </code></pre> <p>You will guess <code>MContextManager</code> is my context manager, I use it for all my queries with CoreData.</p> <p>It's been several hours that I'm trying to map this simple Entity, the error I'm getting is the following:</p> <blockquote> <p>Cannot create managed object contexts: The persistent store coordinator does not have any persistent stores. This likely means that you forgot to add a persistent store or your attempt to do so failed with an error.</p> </blockquote> <p>I though I was setting the persistent store on the first lines, wasn't I ?</p> <h2>Update</h2> <p>I have added this for persistent store:</p> <pre><code>NSURL *appDocs = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; NSString *storeURL = [appDocs URLByAppendingPathComponent:@"my-model.sqlite"].absoluteString; [managedObjectStore addSQLitePersistentStoreAtPath:storeURL fromSeedDatabaseAtPath:nil withConfiguration:nil options:nil error:nil]; </code></pre> <p>With still the same error</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. 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