how to set directly nested keypath in Restkit?

2019-09-04 15:47发布

问题:

hi i need to set directly nested keypath in RKResponseDescriptor like "Data.User" but not getting Value my json like below

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

i need directly entity map to User Without data is it possible

EDIT:

my calling code is

 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)
)