0
這個對象我的JSON以下一種如何映射RESTKit
{
"Client": {
"FirstName": "String",
"LastName": "String",
"Email": "String",
"Password": "String",
"PhoneNumber": "String",
"Token": "String"
},
"ErrorMessage": "String",
"FriendlyMessage": "String"
}
我知道,雖然映射如果我指定的關鍵路徑,然後RestKit從對象字段中指定,在這種情況下Client
匹配,將代碼我使用的是,如下所示
[responseMapping addAttributeMappingsFromDictionary:@{
@"FirstName": @"FirstName",
@"LastName": @"LastName",
@"Email": @"Email",
@"PhoneNumber": @"PhoneNumber",
@"Token": @"Token",
@"Password": @"Password",
@"ErrorMessage": @"ErrorMessage"}];
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:responseMapping
method:RKRequestMethodPOST
pathPattern:nil
keyPath:@"Client"
statusCodes:[NSIndexSet indexSetWithIndex:200]];
但我有兩個額外的字段映射哪些不在客戶端對象下。如何映射ErrorMessage
和FriendlyMessage
字段?
噢,我現在我明白了,我們可以添加多個映射到RKObjectManager,非常感謝,我將添加另一個對象的錯誤 –