ios - restkit 0.20: can not pass in an NSManagedObject to the getObject: method -


i trying retrieve 1 item restful service (confirmed working)

http://www.example.com/person/25 

i need somehow pass in '25' part of url. figure i'm supposed use rkroute. way execute in restkit use getobject: method of rkobjectmanager.

using restkit 0.22 , not know how call getobject: method because expects full person object, no? though need pass in string '25'.

the method in question is: [self getobject:personnsmanagedobject path:nil parameters:nil success:^(rkobjectrequestoperation *operation, rkmappingresult *mappingresult) .....

i can't "person *person = [[person alloc] init] because person nsmanagedobject.

but when this:

nsmanagedobjectcontext *moc = self.managedobjectstore.mainqueuemanagedobjectcontext; nsentitydescription *person = [nsentitydescription entityforname:@"person" inmanagedobjectcontext:moc]; person *personnsmanobj = [[person alloc] initwithentity:person insertintomanagedobjectcontext:nil]; personnsmanobj.id = 3; 

i following error:

performing object mapping temporary target objectid. results may not accessible without obtaining permanent object id. restkit.network:rkresponsemapperoperation.m:457 failed retrieve existing object id: 0x1664ac90

any ideas?

you should save new object persistent store. data load , mapping happening on different thread try map data supplied object. because object inserted not saved has temporary managed object id restkit tries convert object can't. saving create 'stub' object in data store restkit populate response data (assuming success).

an alternative approach supply dictionary required key / value pair inserted route. restkit create destination object you.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -