How do you map relationships using a primary key in Restkit?

Could not find an updated example of how to match relationships like the ones below.

{ "seats": [ { "number": "2A", "user_id": 1 }, { "number": "4E", "user_id": 2 } ], "users": [ { "id": 1, "name": "Foo" }, { "id": 2, "name": "Bar" } ] } 

using RestKit (0.9.3) for the model

 User NSUInteger id NSString* name Seat NSString* number User* user; 
+4
source share
1 answer

I do not think that RestKit can do exactly what you want out of the box.

It is best to modify your details to be more friendly with RestKit. You can do this using the objectLoader: willMapData: delegate method:

http://restkit.org/api/0.9.3/Protocols/RKObjectLoaderDelegate.html#//api/name/objectLoader:willMapData :

0
source

Source: https://habr.com/ru/post/1379628/


All Articles