如何在Restkit中直接设置嵌套的keypath?

时间:2015-11-30 13:43:12

标签: swift restkit restkit-0.20

嗨我需要在RKResponseDescriptor中直接设置嵌套的密钥路径,例如" Data.User"但是没有像我的json那样得到Value

{
 "Data":{
       "User":{
            "name": aaa,
            "mobile": 123456789
        }
 "ResultType":1
 }
}

我需要直接实体地图给用户没有数据是否可能

编辑:

我的通话代码是

 let userMapping = RKEntityMapping(forEntityForName: "User", inManagedObjectStore: rkomUser.managedObjectStore)

userMapping.addAttributeMappingsFromDictionary([
    "Name"                    : "name",
    "Mobile"                  : "mobile"
    ])


let responseDescriptor = RKResponseDescriptor(

    mapping: userMapping,

    method: RKRequestMethod.POST,
    pathPattern: nil,

    keyPath: "Data.User",
    statusCodes: NSIndexSet(index: 201)
)

0 个答案:

没有答案