Eliminate use of keyed subscript access in RKEntityMapping inadvertantly introducing iOS 6.0 dependencies

This commit is contained in:
Blake Watters
2012-12-10 10:50:51 -05:00
parent 7b4098ca6f
commit abe67dcbb5

View File

@@ -45,7 +45,7 @@ static NSArray *RKEntityIdentificationAttributesFromUserInfoOfEntity(NSEntityDes
[NSException raise:NSInvalidArgumentException format:@"Invalid value given in user info key '%@' of entity '%@': expected an `NSString` or `NSArray` of strings, instead got '%@' (%@)", RKEntityIdentificationAttributesUserInfoKey, [entity name], attributeName, [attributeName class]];
}
NSAttributeDescription *attribute = [entity attributesByName][attributeName];
NSAttributeDescription *attribute = [[entity attributesByName] valueForKey:attributeName];
if (! attribute) {
[NSException raise:NSInvalidArgumentException format:@"Invalid identifier attribute specified in user info key '%@' of entity '%@': no attribue was found with the name '%@'", RKEntityIdentificationAttributesUserInfoKey, [entity name], attributeName];
}
@@ -93,7 +93,7 @@ static NSArray *RKArrayOfAttributesForEntityFromAttributesOrNames(NSEntityDescri
if (! [[entity properties] containsObject:attributeOrName]) [NSException raise:NSInvalidArgumentException format:@"Invalid attribute value '%@' given for entity identifer: not found in the '%@' entity", attributeOrName, [entity name]];
[attributes addObject:attributeOrName];
} else if ([attributeOrName isKindOfClass:[NSString class]]) {
NSAttributeDescription *attribute = [entity attributesByName][attributeOrName];
NSAttributeDescription *attribute = [[entity attributesByName] valueForKey:attributeOrName];
if (!attribute) [NSException raise:NSInvalidArgumentException format:@"Invalid attribute '%@': no attribute was found for the given name in the '%@' entity.", attributeOrName, [entity name]];
[attributes addObject:attribute];
} else {
@@ -114,7 +114,7 @@ NSArray *RKIdentificationAttributesInferredFromEntity(NSEntityDescription *entit
NSMutableArray *identifyingAttributes = [RKEntityIdentificationAttributeNamesForEntity(entity) mutableCopy];
[identifyingAttributes addObjectsFromArray:RKEntityIdentificationAttributeNames()];
for (NSString *attributeName in identifyingAttributes) {
NSAttributeDescription *attribute = [entity attributesByName][attributeName];
NSAttributeDescription *attribute = [[entity attributesByName] valueForKey:attributeName];
if (attribute) {
return @[ attribute ];
}
@@ -231,7 +231,7 @@ static BOOL entityIdentificationInferenceEnabled = YES;
- (void)addConnectionForRelationship:(id)relationshipOrName connectedBy:(id)connectionSpecifier
{
NSRelationshipDescription *relationship = [relationshipOrName isKindOfClass:[NSRelationshipDescription class]] ? relationshipOrName : [self.entity relationshipsByName][relationshipOrName];
NSRelationshipDescription *relationship = [relationshipOrName isKindOfClass:[NSRelationshipDescription class]] ? relationshipOrName : [[self.entity relationshipsByName] valueForKey:relationshipOrName];
NSAssert(relationship, @"No relatiobship was found named '%@' in the '%@' entity", relationshipOrName, [self.entity name]);
RKConnectionDescription *connection = nil;
if ([connectionSpecifier isKindOfClass:[NSString class]]) {