RestKit: Creating stubs for foreign key relationships

筅森魡賤 提交于 2019-12-05 15:52:20
Wain

I thought my below answer previously worked, but maybe I always snuck around the issue in the comments about exact matches of response descriptors.

So, create another mapping, but make it a nil keypath mapping and use a keypath on the response descriptor of @"teamId". This will cause RestKit to extract an array of team ids from the response and process them as object items, separate to the user objects.


The JSON is fine. Just create a new response descriptor which uses a teamStubMapping, which is a new mapping like teamMapping but replacing id with teamId. The path pattern of this response descriptor should be @"Users".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!