mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-21 10:54:31 +08:00
Merge pull request #590 from cfis/NSOrderedSet
NSOrderedSet and iOS 4.x Compatability (Again)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user