我有这样的 JSON
{
"result" : 1,
"messages" : [],
"users" : {}
}
两者都messages
被users
填充。
如果我想映射,例如messages
,我会执行以下操作:
messageMapping = [RKObjectMapping mappingForClass:[OLMessage class]];
[messageMapping mapKeyPath:@"user_id" toAttribute:@"userID"];
[messageMapping mapKeyPath:@"status" toAttribute:@"status"];
[messageMapping mapKeyPath:@"text" toAttribute:@"text"];
[messageMapping mapKeyPath:@"date_time" toAttribute:@"date_time"];
messageManager = [RKObjectManager managerWithBaseURLString:baseURL];
[messageManager.mappingProvider setMapping:messageMapping forKeyPath:@"messages"];
[messageManager loadObjectsAtResourcePath:@"/messages/fetch" usingBlock:^(RKObjectLoader *loader) { ... };
我收到了我的信息。
如何设置我的映射以获得users
相同的调用loadObjectsAtResourcePath
?