Note that there are some explanatory texts on larger screens.

plurals
  1. PORestkit 0.20 pre4 core data issue
    primarykey
    data
    text
    <pre><code>{"status":"ok", "count":5, "count_total":165, "pages":33, "posts":[{ "id":2971, "status":"publish", "title":"title1", "content":"", "date":"date", "categories":[{"id":5, "title":"category1"}, {"id":7, "title":"category2"}], "thumbnail":"url", "custom_fields":{"wpcf-content":["content"], "wpcf-audio":["url"]} }, { "id":2974, "status":"publish", "title":"title2", "content":"", "date":"date2", "categories":[{"id":5, "title":"category1"}, {"id":5, "title":"category3"} ], "thumbnail":"url", "custom_fields":{"wpcf-content":["content"], "wpcf-audio":["url"]} } ] } posts.h @interface posts : NSManagedObject @property (nonatomic, retain) NSString* title; @property (nonatomic, retain) NSArray* wpcf-content; @property (nonatomic, retain) NSArray* wpcf-audio; @property (nonatomic, retain) NSString* id; @property (nonatomic, retain) NSArray* categories; @end categories.h @interface categories : NSManagedObject @property (nonatomic, retain) NSString* title; @end Model.xcdatamodeld entities Posts : title (string), id (integer 64),wpcf-audio (transformable),wpcf-content (transformable) Categories : title (string) NSManagedObjectModel *managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil]; RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel]; NSString *path = [RKApplicationDataDirectory() stringByAppendingPathComponent:@"Model.sqlite"]; [managedObjectStore addSQLitePersistentStoreAtPath:path fromSeedDatabaseAtPath:nil withConfiguration:nil options:nil error:nil]; [managedObjectStore createManagedObjectContexts]; RKEntityMapping *categoryMapping = [RKEntityMapping mappingForEntityForName:@"Categories" inManagedObjectStore:managedObjectStore]; [categoryMapping addAttributeMappingsFromDictionary:@{ @"title":@"title"}]; RKEntityMapping *mapping = [RKEntityMapping mappingForEntityForName:@"Posts" inManagedObjectStore:managedObjectStore]; NSArray *identification =[[NSArray alloc]initWithObjects:@"id", nil]; mapping.identificationAttributes= identification; [mapping addAttributeMappingsFromArray:@[@"title",@"id",@"custom_fields.wpcf-content",@"custom_fields.wpcf-audio"]]; NSIndexSet *statusCodes = RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful); // Anything in 2xx RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:mapping pathPattern:nil keyPath:@"posts" statusCodes:statusCodes]; [mapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"categories" toKeyPath:@"categories" withMapping:categoryMapping]]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://my.url/json"]]; RKManagedObjectRequestOperation *operation = [[RKManagedObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[responseDescriptor]]; operation.managedObjectContext = managedObjectStore.mainQueueManagedObjectContext; [operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *result) { posts *article = [result firstObject]; categories *catego =[article.categories objectAtIndex:0]; NSLog(@"Mapped the article: %@", article.title); NSLog(@"Mapped the article: %@", catego.title); } failure:^(RKObjectRequestOperation *operation, NSError *error) { NSLog(@"Failed with error: %@", [error localizedDescription]); }]; RKObjectManager *manager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://my.url/"]]; [manager enqueueObjectRequestOperation:operation]; </code></pre> <p>I get this error W restkit.core_data:RKManagedObjectMappingOperationDataSource.m:157 Performing managed object mapping with a nil managed object cache:</p> <p>Unable to update existing object instances by identification attributes. Duplicate objects may be created.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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