ios - Restkit NSInternalInconsistencyException Unable to add mapping for keyPath -


fyi, i'm not familiar restkit's api. prefer other means of deserializing json domain objects; however, i've inherited project , quickest solution fix bug.

i'm trying map "assignments" in below json "doctorassignments" 1-many relationship in core data.

example json:

{     "id": 43,     "time_zone": "mountain time (us & canada)",     "accepting_patients": true,     "auto_set_context_id": 44,     "audio_notifications": false,     "assignments": [         {             "id": 14,             "active_since": "2015-06-17t23:26:03z",             "doctor": {                 "id": 44,                 "name": "darth vader psyd",                 "title": "dr.",                 "bio": "",                 "type": "doctor",                 "profile_image_url": "https://cirrusmd-staging.s3.amazonaws.com/uploads/doctor/profile_image/43/darth.png?x-amz-expires=600&x-amz-date=20150618t163351z&x-amz-algorithm=aws4-hmac-sha256&x-amz-credential=akiajgwzjvklzcgmxj2q/20150618/us-east-1/s3/aws4_request&x-amz-signedheaders=host&x-amz-signature=b0bc0163f4cf8c3c73572198c596565b0012a33331936baf4b14b9a255c0870f",                 "credential_id": 214             }         }     ],     "practice": {         "id": 2,         "name": "test practice",         "address": "",         "phone": "",         "fax": "",         "created_at": "2013-06-11t17:49:48z",         "updated_at": "2013-06-11t17:49:48z",         "email": "",         "city": "",         "state": "",         "zip": ""     } } 

mapping:

    + (rkentitymapping *)responsemapping {     if (_responsemapping == nil) {         _responsemapping = [rkentitymapping mappingforentityforname:[cmduser entityname] inmanagedobjectstore:[nsmanagedobject managedobjectstore]];         _responsemapping.identificationattributes = @[ cmduserattributes.userid, cmduserattributes.type ];          [_responsemapping addattributemappingsfromdictionary:@{             @"id" : cmduserattributes.userid,             @"type" : cmduserattributes.type,             @"profile_image_url" : cmduserattributes.profilepic,             @"credential_id" : cmduserattributes.credentialid,             @"name" : cmduserattributes.name,             @"last_name" : cmduserattributes.lastname,             @"first_name" : cmduserattributes.firstname,             @"allergies" : cmduserattributes.allergies,             @"medications" : cmduserattributes.medications,             @"history" : cmduserattributes.history,             @"email" : cmduserattributes.email,             @"location" : cmduserattributes.location,             @"zipcode" : cmduserattributes.zipcode,             @"gender" : cmduserattributes.gender,             @"dob" : cmduserattributes.dob,             @"relationship.state" : cmduserattributes.relationshipstate,             @"relationship.status" : cmduserattributes.relationshipstatus,             @"relationship.onboarded_at" : cmduserattributes.onboardedat,             @"auto_set_context_id" : cmduserattributes.autosetcontextid,             @"phone" : @"phone",         }];     }     // taking line out removes exception, json isn't mapped     [_responsemapping addpropertymapping:[rkrelationshipmapping relationshipmappingfromkeypath:@"assignments" tokeypath:@"doctorassignments" withmapping:[cmddoctorassignment mapping]]];      return _responsemapping; } 

on launch error: terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'unable add mapping keypath doctorassignments, 1 exists...'

note: i've omitted fields in json. in mapping, not have

@"assignments": @"doctorassignments".


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -