对于简单的对象响应
{"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"}]