有没有办法以编程方式“捕获”RestKit中的映射验证错误?

时间:2014-01-05 20:55:31

标签: objective-c restkit

如果我的映射设置不正确,那么当我在RKObjectManager上调用以下方法来获取对象时:

- (void)getObjectsAtPath:(NSString *)path
              parameters:(NSDictionary *)parameters
                 success:(void (^)(RKObjectRequestOperation *operation, RKMappingResult *mappingResult))success
                 failure:(void (^)(RKObjectRequestOperation *operation, NSError *error))failure

根据源解析映射时,日志中会出现以下错误:

2014-01-05 20:49:35.020 xxxx[26224:1807] E restkit.object_mapping:RKMappingOperation.m:335 Validation failed while mapping attribute at key path 'xxxx' to value <xxx: 0xc3d1930> (entity: xxx; id: 0xc3d1970 <x-coredata:///xxxx/tCC01E8C7-B34D-4302-A889-67E21C58275D18> ; data: {
    xxxx = xxxx,
    xxxx = xxxx 
}). Error: The operation couldn’t be completed. (Cocoa error 1550.)

然而,尽管所有映射操作都已失败,但调用成功块而不是失败块。

有没有办法确定这些错误是否在成功区块内发生?从我的测试的角度来看,操作成功但只是没有返回结果。

0 个答案:

没有答案