Note that there are some explanatory texts on larger screens.

plurals
  1. PORestkit mapping error
    text
    copied!<p>I am new to restkit, and i am using it in my application along with core data. I was pretty amazed with the way restkit works with core- data. It is simply amazing. But i am facing a major issue while parsing one of my webservices. The app keeps on crashing and is not able to map a value from the response. Following is my response-</p> <p>[ { "id": 10, "created": "2012-10-06 13:32:09 +0000", "createdBy": null, "functionalCurrency": null, "imageUrl": null, "lat": null, "lon": null, "maxOccupancy": 0, "name": "Patio Dining", "posX": 0, "posY": 0, "reportingCurrency": null, "salesTaxRate1": 0, "salesTaxRate2": 0, "salesTaxRate3": 0, "salesTaxRate4": 0, "timezone": "-0830", "transactionalCurrency": null, "updated": "2012-10-06 13:32:09 +0000", "updatedBy": null}]</p> <p>I am getting the following error.- </p> <p><strong>E restkit.object_mapping:RKObjectMappingOperation.m:262 Validation failed while mapping attribute at key path 'locationId' to value 10. Error: The operation couldn’t be completed. (Cocoa error 1610.) -[__NSCFNumber length]: unrecognized selector sent to instance 0x774e020</strong></p> <p>My location class is declared as follows-</p> <pre><code>@interface Location : NSManagedObject @property (nonatomic,strong)NSNumber *locationId; @property (strong, nonatomic) NSString *created; @property (nonatomic,strong) NSString *createdBy; @property (nonatomic,strong) NSString *functionalCurrency; @property (nonatomic,strong) NSString *imageUrl; @property (strong, nonatomic) NSString *lat; @property (strong, nonatomic) NSString *lon; </code></pre> <p>I initialize the manager as follows-</p> <pre><code> RKURL *baseURL = [RKURL URLWithBaseURLString:serverUrl]; objectManager = [RKObjectManager objectManagerWithBaseURL:baseURL]; objectManager.client.baseURL = baseURL; objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; [RKObjectManager setSharedManager:objectManager]; [objectManager loadObjectsAtResourcePath:[NSString stringWithFormat:@"%@", [URL resourcePath]] delegate:self]; </code></pre> <p>When i try to set the locationId to NSString the RKObjectManager simply does not match any values after '9'. and when set to NSNumber it does not match any values after '2'. </p> <p>Please help me. The same thing is happening for RKManagedObjectMapping and hence no data goes into my core data file. </p>
 

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