mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Eliminate use of keyed subscript access in RKEntityMapping inadvertantly introducing iOS 6.0 dependencies
This commit is contained in:
@@ -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]]) {
|
||||
|
||||
Reference in New Issue
Block a user