0
我正在嘗試來自服務器xml的映射錯誤響應。在restkit 0.21版本中,它工作正常。在上一個版本中沒有(0.22以上)。服務器可能的響應是<authorization-fail/>
。許多服務器功能可能導致這種響應。在RestKit中用於xml的對象映射器
+ (void)addAuthErrorMapping:(RKObjectManager*)objectManager
{
RKObjectMapping* errorMapping = [RKObjectMapping mappingForClass:[RKErrorMessage class]];
[errorMapping addPropertyMapping:[RKAttributeMapping attributeMappingFromKeyPath:nil
toKeyPath:@"errorMessage"]];
RKResponseDescriptor* errorResponseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:errorMapping
method:RKRequestMethodGET
pathPattern:nil
keyPath:@"authorization-fail"
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
[objectManager addResponseDescriptor:errorResponseDescriptor];
}
在0.21版本中,我使用authorisation-fail
鍵獲得字典。在最後的版本中,結果是空的字典。
具體說明工作和不工作的版本。它做什麼呢?你可能想在github上引發一個bug(帶有示例代碼)。 – Wain 2014-09-12 07:37:06
更新了我的問題。問題也在github上完成。 – Sol 2014-09-16 14:11:44