Restkit keyPath问题,instagram

时间:2015-12-10 22:48:18

标签: ios objective-c mapping restkit

json回复(来自Instagram)

{
  "meta": {
     "code": 200
  },
 "data": [
 {
  "username": "victoriassecret",
  "profile_picture": "https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-19/11373751_810224469095258_1164651624_a.jpg",
  "id": "3416684",
  "full_name": "Victoria's Secret"
},
{
  "username": "vsco",
  "profile_picture": "https://scontent.cdninstagram.com/hphotos-xtp1/t51.2885-19/s150x150/11899636_1028996767152033_435823497_a.jpg",
  "id": "40238620",
  "full_name": "VSCO"
},
{
  "username": "vegas_nay",
  "profile_picture": "https://scontent.cdninstagram.com/hphotos-xpt1/t51.2885-19/s150x150/12106144_1657363291168907_1032227973_a.jpg",
  "id": "19619019",
  "full_name": ""
  }
]
}

我正在尝试取出data数组并将其映射到名为SocialFriend的对象中:

 request.responseDescriptors = @[[RKResponseDescriptor responseDescriptorWithMapping:[WSISocialFriend mappingWithManagedObjectStore:wsi_managedObjectStore network:network]
                                                                                 method:RKRequestMethodGET
                                                                            pathPattern:nil
                                                                                keyPath:@"data"
                                                                            statusCodes:WSIAPISuccessfulStatusCodes()]];

但是在objectRequestOperation完成后,如果失败并且这会在我的控制台上打印

NSLocalizedFailureReason=The mapping operation was unable to find any nested object representations at the key paths searched: The representation inputted to the mapper was found to contain nested object representations at the following key paths: data, meta This likely indicates that you have misconfigured the key paths for your mappings., keyPath=null, DetailedErrors=( )}}, keyPath=null, NSLocalizedDescription=No response descriptors match the response loaded.}

为什么要打印keyPath=null?我在这里缺少一些关键的东西,任何洞察力都赞赏,谢谢。我很满意我的SocialFriend文件映射得很好,但我需要通过keyPath问题

0 个答案:

没有答案