I have an iOS app that is using Restkit to pull info from a server. I have reached a point where I am using more than one CoreData Entity. I have set up an new entity mapping for restkit but my response from the server results in no mappable values because it is using the wrong entity mapping. Can someone clue me in on how to tell it which one to use.
Here are the two mappers:
RKEntityMapping *articleEntityMapping = [RKEntityMapping mappingForEntityForName:@"Gist" inManagedObjectStore:managedObjectStore];
[entityMapping addAttributeMappingsFromDictionary:@{
@"id.text": @"gistID",
@"title.text": @"title",
@"hashtags.text": @"hashtags",
@"imageUrl.text": @"imageUrl",
@"description.text": @"summary",
@"copy.text": @"fullArticle",
@"articleId.text": @"articleId"}];
entityMapping.identificationAttributes = @[ @"gistID" ];
RKEntityMapping *userEntityMapping = [RKEntityMapping mappingForEntityForName:@"UserInfo" inManagedObjectStore:managedObjectStore];
[userEntityMapping addAttributeMappingsFromDictionary:@{
@"firstName.text": @"firstName",
@"lastName.text": @"lastName",
@"birthDay.text": @"birthDay",
@"birthMonth.text": @"birthMonth",
@"birthYear.text": @"birthYear"}];
userEntityMapping.identificationAttributes = @[ @"birthDay" ];
I thought the identificationAttributes
gave it the cue but it didn't seem to work. There is no relationship between these two entities. They come from completely unrelated API's on the server side.
Here is what I am using to make the request that uses articleEntityMapping
[[RKObjectManager sharedManager] postObject:nil path:@"/rest/search?ip=255.255.255.0" parameters:search success:nil failure:nil];
Here is what I am using to make the request that userEntityMapping
should use but doesn't.
[[RKObjectManager sharedManager] postObject:nil path:@"/rest/person/login?ip=255.255.255.0" parameters:postBody success:nil failure:nil];