Reputation: 812
I have used common RKObjectManager used for different entity mapping as the following below cod but when i try to make mapping for specific entity couldn't because i have two entity with same keyPath this the problem how i can figured.
// 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)];
Upvotes: 0
Views: 80
Reputation: 119021
You should use the pathPattern
parameter to allow RestKit to know which response descriptor to use when you make a particular request (because you should be using different paths in the URLs for different entities).
If for some reason you can't, you would need to create multiple instances of RKObjectManager
and use the appropriate one for each different request that you make.
Upvotes: 3