我有以下 JSON:
{
"stream": [{
"catalog": {}
}, {
"catalog": {}
}, {
"user": {}
}]
}
具有以下映射规则:
[RKResponseDescriptor responseDescriptorWithMapping:catalogMapping
pathPattern:nil keyPath:@"stream.catalog"
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)]];
[RKResponseDescriptor responseDescriptorWithMapping:userMapping
pathPattern:nil keyPath:@"stream.user"
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)]];
映射工作正常,直到流中有多种类型的对象。当流包含多个对象时,比如说用户和目录 restkit 失败了这个断言:
NSCAssert([representation isKindOfClass:[NSDictionary class]], @"Expected a dictionary representation");
有没有办法映射该结构?