Unfortunately introduced an error while fixing #342 in commit a1b2201 in the RKObjectMappingProvider where retrieving mappings by class was broken, partially, yet passed unit tests. This fixes the bug and covers the gap in the tests.

This commit is contained in:
Greg Combs
2011-09-18 21:06:19 -05:00
parent 52e5a7b911
commit e33d9e519a
3 changed files with 74 additions and 2 deletions

View File

@@ -79,10 +79,10 @@
NSMutableArray* mappings = [NSMutableArray array];
NSArray* mappingsToSearch = [[NSArray arrayWithArray:_objectMappings] arrayByAddingObjectsFromArray:[_mappingsByKeyPath allValues]];
for (NSObject <RKObjectMappingDefinition> *candidateMapping in mappingsToSearch) {
if (![candidateMapping respondsToSelector:@selector(objectClass)] || [mappings containsObject:candidateMapping])
if ( ![candidateMapping respondsToSelector:@selector(objectClass)] || [mappings containsObject:candidateMapping])
continue;
Class mappedClass = [candidateMapping performSelector:@selector(objectClass)];
if (mappedClass == theClass) {
if (mappedClass && [NSStringFromClass(mappedClass) isEqualToString:NSStringFromClass(theClass)]) {
[mappings addObject:candidateMapping];
}
}