我已经设置了这样的响应描述符:
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:exhibitMapping method:RKRequestMethodAny pathPattern:@"?json=exhibits/get_exhibits" keyPath:@"d.exhibits" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
并提出了这样的要求:
[[RKObjectManager sharedManager] getObjectsAtPath:@"?json=exhibits/get_exhibits" parameters:nil success:
但是我收到了这个错误:
2014-03-17 11:14:39.856 MuseumMap[6135:60b] E app:ExhibitTableViewController.m:49 Load failed with error: Error Domain=org.restkit.RestKit.ErrorDomain Code=1001 "No response descriptors match the response loaded." UserInfo=0x8fb69f0 {NSErrorFailingURLStringKey=http://exhibits.wpengine.com/?json=exhibits/get_exhibits, NSLocalizedFailureReason=A 200 response was loaded from the URL 'http://exhibits.wpengine.com/?json=exhibits/get_exhibits', which failed to match all (1) response descriptors:
<RKResponseDescriptor: 0x9480270 baseURL=http://exhibits.wpengine.com/ pathPattern=?json=exhibits/get_exhibits statusCodes=200-299> failed to match: response path '?json=exhibits/get_exhibits' did not match the path pattern '?json=exhibits/get_exhibits'., NSLocalizedDescription=No response descriptors match the response loaded., keyPath=null, NSErrorFailingURLKey=http://exhibits.wpengine.com/?json=exhibits/get_exhibits, NSUnderlyingError=0x8fb6990 "No mappable object representations were found at the key paths searched."}
我的想法是因为要么匹配问题?或者路径模式中的=但是我试图逃避这些并且它似乎没有什么区别。任何人都有任何想法,为什么这不匹配?错误消息response path '?json=exhibits/get_exhibits' did not match the path pattern '?json=exhibits/get_exhibits'.
似乎有点过时了。
答案 0 :(得分:1)
问题在于URL的形成方式。我改变了我的网站使用固定链接而不是?json查询参数,这似乎有效。路径匹配在匹配之前消除了查询参数,因此这些参数不能用于在restkit中匹配。
http://wordpress.org/plugins/json-api/other_notes/#1.1.-Requests