Skip to content

Commit

Permalink
Remove references to NSOrderedSet to maintain iOS 4.x compatability.
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie Savage committed Mar 11, 2012
1 parent 9b6992a commit 08e65ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Code/ObjectMapping/RKObjectMappingOperation.m
Expand Up @@ -186,7 +186,7 @@ - (id)transformValue:(id)value atKeyPath:(NSString *)keyPath toType:(Class)desti
} else if (orderedSetClass && [sourceType isSubclassOfClass:orderedSetClass]) {
// OrderedSet -> Array
if ([destinationType isSubclassOfClass:[NSArray class]]) {
return [(NSOrderedSet*)value array];
return [value array];
}
} else if ([sourceType isSubclassOfClass:[NSArray class]]) {
// Array -> Set
Expand Down
5 changes: 3 additions & 2 deletions Code/ObjectMapping/RKObjectSerializer.m
Expand Up @@ -109,6 +109,7 @@ - (id)serializedObjectForMIMEType:(NSString*)MIMEType error:(NSError**)error {

- (void)objectMappingOperation:(RKObjectMappingOperation *)operation didSetValue:(id)value forKeyPath:(NSString *)keyPath usingMapping:(RKObjectAttributeMapping *)mapping {
id transformedValue = nil;
Class orderedSetClass = NSClassFromString(@"NSOrderedSet");

if ([value isKindOfClass:[NSDate class]]) {
// Date's are not natively serializable, must be encoded as a string
Expand All @@ -118,9 +119,9 @@ - (void)objectMappingOperation:(RKObjectMappingOperation *)operation didSetValue
} else if ([value isKindOfClass:[NSDecimalNumber class]]) {
// Precision numbers are serialized as strings to work around Javascript notation limits
transformedValue = [(NSDecimalNumber*)value stringValue];
} else if ([value isKindOfClass:[NSOrderedSet class]]) {
} else if ([value isKindOfClass:orderedSetClass]) {
// NSOrderedSets are not natively serializable, so let's just turn it into an NSArray
transformedValue = [(NSOrderedSet *)value array];
transformedValue = [value array];
}

if (transformedValue) {
Expand Down

0 comments on commit 08e65ac

Please sign in to comment.