我已经使用了用于不同实体映射的通用 RKObjectManager,如下面的鳕鱼,但是当我尝试为特定实体进行映射时不能,因为我有两个具有相同 keyPath 的实体,这是我怎么能想到的问题。
// Search mapping ...
RKEntityMapping *searchEntityMapping = [RKEntityMapping mappingForEntityForName:NSStringFromClass([ABB class]) inManagedObjectStore: aBBManager.managedObjectStore];
[searchInfoEntityMapping addAttributeMappingsFromDictionary:@{
@"count" : @"count",
@"total_count" : @"totalCount",
}];
// Search Advanced mapping ...
RKEntityMapping *searchAdvEntityMapping = [RKEntityMapping mappingForEntityForName:NSStringFromClass([ABB class]) inManagedObjectStore: aBBManager.managedObjectStore];
[searchAdvEntityMapping addAttributeMappingsFromDictionary:@{
@"count" : @"count",
@"data" : @"dataCount",
}];
// Search Descriptor
RKResponseDescriptor *aBBResponseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:searchEntityMapping pathPattern:nil keyPath:@"locations" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
// Search Adv Descriptor
RKResponseDescriptor *aBB2ResponseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:searchAdvEntityMapping pathPattern:nil keyPath:@"locations" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];