我正在使用以下代码来解析四方菜单 API Json 响应。
RKURL *baseURL = [RKURL URLWithBaseURLString:@"https://api.foursquare.com/v2"];
RKObjectManager *objectManager = [RKObjectManager objectManagerWithBaseURL:baseURL];
objectManager.client.baseURL = baseURL;
RKObjectMapping *menuMapping = [RKObjectMapping mappingForClass:[MenuSession class]];
[menuMapping mapKeyPathsToAttributes:@"name", @"name", @"description", @"description", nil];
[objectManager.mappingProvider setMapping:menuMapping forKeyPath:@"response.menu.menus.items"];
但是,我得到了错误:找不到 keyPath 的对象映射:''
这是 RestKit 请求使用的 URL: https ://api.foursquare.com/v2/venues/4a5ceb3af964a520d9bc1fe3/menu?client_secret=JBBJHVG3XZ1O4ZADAYHGMZLDNQWQ4HIJ2SG120MZ54GDCN1L&client_id=OSPAJRKHA4T53AGDZICIE0CL15DZCTJJJWDY3
任何帮助都感激不尽!
以下是 Json 解析器中显示的响应
object {2}
meta {3}
response {1}
menu {2}
provider {4}
menus {2}
count : 1
items [1]
0 {4}
menuId : myrf53yuauz9tlgtj6k4suf84
name : Main Menu
description :
entries {2}
完整的错误消息是:2013-10-16 22:50:04.842 CoffeeShop[807:a0b] 响应代码:200 2013-10-16 22:50:04.847 CoffeeShop[807:1403] W restkit.object_mapping:RKObjectMapper.m :81 添加映射错误:找不到 keyPath 的对象映射:'' 2013-10-16 22:50:04.847 CoffeeShop[807:1403] E restkit.network:RKObjectLoader.m:216 在映射过程中遇到错误:无法找到 keyPath 的对象映射:'' 2013-10-16 22:50:04.848 CoffeeShop[807:a0b] 错误:找不到 keyPath 的对象映射:''