0

単純なオブジェクト応答の場合

{"api_key": "cool api key"}

私はRKObjectMappingこのように使用します:

class APIRegisterResult: NSObject {
    var api_key: String = ""
}


let registerMapping : RKObjectMapping = RKObjectMapping(forClass: APIRegisterResult.self)
registerMapping.addAttributeMappingsFromArray(["api_key"])

objectManager.addResponseDescriptor(RKResponseDescriptor(mapping: registerMapping, method: RKRequestMethod.POST, pathPattern:"register", keyPath: nil, statusCodes: NSIndexSet(index: 200)))

単純な配列応答に使用する方法は?

[{"id:"cool id"},{"id":"cooler id"}]
4

0 に答える 0