Reputation: 58
Have not found this case in any of the RestKit documentation so far, so I guess it just does not work:
This mapping, where I'm using the key "theText" twice
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[DummyText class]];
[mapping addAttributeMappingsFromDictionary:@{
@"theText": @"title",
@"theText": @"label",
@"somethingElse": @"yesSomethingElse"
}];
will return a successfully mapped DummyText object, but only with title filled with the value from the key "theText", but label is nil.
Is there a way, how I can fill a key's value into multiple destination attributes?
Upvotes: 1
Views: 76
Reputation: 119031
I thought the mapping actually raised an exception if you try to configure it like that...
Anyway, you can create a custom accessor method on your destination class and use the mapping to call that accessor method, then, in that method, set your 2 variables.
Upvotes: 1