Merge pull request #590 from cfis/NSOrderedSet

NSOrderedSet and iOS 4.x Compatability (Again)
This commit is contained in:
Blake Watters
2012-03-12 10:26:17 -07:00
2 changed files with 4 additions and 3 deletions

View File

@@ -186,7 +186,7 @@ BOOL RKObjectIsValueEqualToValue(id sourceValue, id destinationValue) {
} 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

View File

@@ -109,6 +109,7 @@
- (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
@@ -118,9 +119,9 @@
} 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) {