Permalink
Browse files

Use runtime checks for NSOrderedSet class to enable building against …

…iOS 4.x and OS X 10.6. fixes #568, #545
  • Loading branch information...
1 parent 161ea6a commit e66f65bb5ed09377e8fd74f2c9b39b7080a81bae @blakewatters blakewatters committed Feb 25, 2012
Showing with 38 additions and 150 deletions.
  1. +4 −3 Code/ObjectMapping/RKObjectMappingOperation.m
  2. +34 −147 Examples/RKMacOSX/RKMacOSX.xcodeproj/project.pbxproj
@@ -129,6 +129,7 @@ - (NSDate*)parseDateFromString:(NSString*)string {
- (id)transformValue:(id)value atKeyPath:keyPath toType:(Class)destinationType {
RKLogTrace(@"Found transformable value at keyPath '%@'. Transforming from type '%@' to '%@'", keyPath, NSStringFromClass([value class]), NSStringFromClass(destinationType));
Class sourceType = [value class];
+ Class orderedSetClass = NSClassFromString(@"NSOrderedSet");
if ([sourceType isSubclassOfClass:[NSString class]]) {
if ([destinationType isSubclassOfClass:[NSDate class]]) {
@@ -160,7 +161,7 @@ - (id)transformValue:(id)value atKeyPath:keyPath toType:(Class)destinationType {
if ([destinationType isSubclassOfClass:[NSArray class]]) {
return [(NSSet*)value allObjects];
}
- } else if ([sourceType isSubclassOfClass:[NSOrderedSet class]]) {
+ } else if (orderedSetClass && [sourceType isSubclassOfClass:orderedSetClass]) {
// OrderedSet -> Array
if ([destinationType isSubclassOfClass:[NSArray class]]) {
return [(NSOrderedSet*)value array];
@@ -171,8 +172,8 @@ - (id)transformValue:(id)value atKeyPath:keyPath toType:(Class)destinationType {
return [NSSet setWithArray:value];
}
// Array -> OrderedSet
- if ([destinationType isSubclassOfClass:[NSOrderedSet class]]) {
- return [NSOrderedSet orderedSetWithArray:value];
+ if (orderedSetClass && [destinationType isSubclassOfClass:orderedSetClass]) {
+ return [orderedSetClass orderedSetWithArray:value];
}
} else if ([sourceType isSubclassOfClass:[NSNumber class]] && [destinationType isSubclassOfClass:[NSDate class]]) {
// Number -> Date
@@ -7,107 +7,54 @@
objects = {
/* Begin PBXBuildFile section */
+ 25A8BA7A14F9458C005C7314 /* RestKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2534806B14F941A900565CED /* RestKit.framework */; };
25D63919135184CE000879B1 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D63918135184CE000879B1 /* Cocoa.framework */; };
25D63923135184CE000879B1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 25D63921135184CE000879B1 /* InfoPlist.strings */; };
25D63926135184CE000879B1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 25D63925135184CE000879B1 /* main.m */; };
25D63929135184CE000879B1 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 25D63927135184CE000879B1 /* Credits.rtf */; };
25D6392C135184CE000879B1 /* RKMacOSXAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 25D6392B135184CE000879B1 /* RKMacOSXAppDelegate.m */; };
25D6392F135184CF000879B1 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 25D6392D135184CF000879B1 /* MainMenu.xib */; };
- 25D6397813518514000879B1 /* libRestKitCoreData.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397213518514000879B1 /* libRestKitCoreData.a */; };
- 25D6397913518514000879B1 /* libRestKitJSONParserJSONKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397313518514000879B1 /* libRestKitJSONParserJSONKit.a */; };
- 25D6397A13518514000879B1 /* libRestKitNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397413518514000879B1 /* libRestKitNetwork.a */; };
- 25D6397B13518514000879B1 /* libRestKitObjectMapping.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397513518514000879B1 /* libRestKitObjectMapping.a */; };
- 25D6397C13518514000879B1 /* libRestKitSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397613518514000879B1 /* libRestKitSupport.a */; };
25D6397F13518574000879B1 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397E13518574000879B1 /* CoreData.framework */; };
25D639811351858A000879B1 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D639801351858A000879B1 /* AppKit.framework */; };
25D63983135185B6000879B1 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D63982135185B6000879B1 /* SystemConfiguration.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
- 25D63957135184F1000879B1 /* PBXContainerItemProxy */ = {
+ 2534806614F941A900565CED /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
proxyType = 2;
- remoteGlobalIDString = 253A07FC1255161B00976E89;
- remoteInfo = RestKitNetwork;
- };
- 25D63959135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 253A08031255162C00976E89;
- remoteInfo = RestKitObjectMapping;
- };
- 25D6395B135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 253A080C12551D3000976E89;
- remoteInfo = RestKitSupport;
- };
- 25D6395D135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 2590E64F125231F600531FA8;
- remoteInfo = "RestKitJSONParser+YAJL";
- };
- 25D6395F135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 2590E66B1252353700531FA8;
- remoteInfo = "RestKitJSONParser+SBJSON";
- };
- 25D63961135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 73057FD11331AD2E001908EE;
- remoteInfo = "RestKitJSONParser+JSONKit";
- };
- 25D63963135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 25BD43BD1340315800DBACDD;
- remoteInfo = "RestKitXMLParser+Libxml";
+ remoteGlobalIDString = 25160D1614564E810060A5C5;
+ remoteInfo = RestKit;
};
- 25D63965135184F1000879B1 /* PBXContainerItemProxy */ = {
+ 2534806814F941A900565CED /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
proxyType = 2;
- remoteGlobalIDString = 253A081412551D5300976E89;
- remoteInfo = RestKitCoreData;
+ remoteGlobalIDString = 25160D2614564E820060A5C5;
+ remoteInfo = RestKitTests;
};
- 25D63967135184F1000879B1 /* PBXContainerItemProxy */ = {
+ 2534806A14F941A900565CED /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
proxyType = 2;
- remoteGlobalIDString = 2523360511E79F090048F9B4;
- remoteInfo = RestKitThree20;
+ remoteGlobalIDString = 25160E62145651060060A5C5;
+ remoteInfo = RestKitFramework;
};
- 25D63969135184F1000879B1 /* PBXContainerItemProxy */ = {
+ 2534806C14F941A900565CED /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
proxyType = 2;
- remoteGlobalIDString = 3F6C39A510FE5C95008F47C5;
- remoteInfo = UISpec;
+ remoteGlobalIDString = 25160E78145651060060A5C5;
+ remoteInfo = RestKitFrameworkTests;
};
25D6397013518504000879B1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
proxyType = 1;
- remoteGlobalIDString = 255B7588133BABBF00ED76AD;
+ remoteGlobalIDString = 25160D1514564E810060A5C5;
remoteInfo = RestKit;
};
- 25FB6D9F13E4848200F48969 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 20808DBD13DE8CDC000A156A;
- remoteInfo = "RestKitJSONParser+NXJSON";
- };
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
@@ -141,14 +88,10 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 25A8BA7A14F9458C005C7314 /* RestKit.framework in Frameworks */,
25D63983135185B6000879B1 /* SystemConfiguration.framework in Frameworks */,
25D639811351858A000879B1 /* AppKit.framework in Frameworks */,
25D6397F13518574000879B1 /* CoreData.framework in Frameworks */,
- 25D6397813518514000879B1 /* libRestKitCoreData.a in Frameworks */,
- 25D6397913518514000879B1 /* libRestKitJSONParserJSONKit.a in Frameworks */,
- 25D6397A13518514000879B1 /* libRestKitNetwork.a in Frameworks */,
- 25D6397B13518514000879B1 /* libRestKitObjectMapping.a in Frameworks */,
- 25D6397C13518514000879B1 /* libRestKitSupport.a in Frameworks */,
25D63919135184CE000879B1 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -222,17 +165,10 @@
25D63939135184F0000879B1 /* Products */ = {
isa = PBXGroup;
children = (
- 25D63958135184F1000879B1 /* libRestKitNetwork.a */,
- 25D6395A135184F1000879B1 /* libRestKitObjectMapping.a */,
- 25D6395C135184F1000879B1 /* libRestKitSupport.a */,
- 25FB6DA013E4848200F48969 /* libRestKitJSONParserNXJSON.a */,
- 25D6395E135184F1000879B1 /* libRestKitJSONParserYAJL.a */,
- 25D63960135184F1000879B1 /* libRestKitJSONParserSBJSON.a */,
- 25D63962135184F1000879B1 /* libRestKitJSONParserJSONKit.a */,
- 25D63964135184F1000879B1 /* libRestKitXMLParserLibxml.a */,
- 25D63966135184F1000879B1 /* libRestKitCoreData.a */,
- 25D63968135184F1000879B1 /* libRestKitThree20.a */,
- 25D6396A135184F1000879B1 /* RestKitSpecs.app */,
+ 2534806714F941A900565CED /* libRestKit.a */,
+ 2534806914F941A900565CED /* RestKitTests.octest */,
+ 2534806B14F941A900565CED /* RestKit.framework */,
+ 2534806D14F941A900565CED /* RestKitFrameworkTests.octest */,
);
name = Products;
sourceTree = "<group>";
@@ -304,81 +240,32 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
- 25D63958135184F1000879B1 /* libRestKitNetwork.a */ = {
+ 2534806714F941A900565CED /* libRestKit.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
- path = libRestKitNetwork.a;
- remoteRef = 25D63957135184F1000879B1 /* PBXContainerItemProxy */;
+ path = libRestKit.a;
+ remoteRef = 2534806614F941A900565CED /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
- 25D6395A135184F1000879B1 /* libRestKitObjectMapping.a */ = {
+ 2534806914F941A900565CED /* RestKitTests.octest */ = {
isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitObjectMapping.a;
- remoteRef = 25D63959135184F1000879B1 /* PBXContainerItemProxy */;
+ fileType = wrapper.cfbundle;
+ path = RestKitTests.octest;
+ remoteRef = 2534806814F941A900565CED /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
- 25D6395C135184F1000879B1 /* libRestKitSupport.a */ = {
+ 2534806B14F941A900565CED /* RestKit.framework */ = {
isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitSupport.a;
- remoteRef = 25D6395B135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D6395E135184F1000879B1 /* libRestKitJSONParserYAJL.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitJSONParserYAJL.a;
- remoteRef = 25D6395D135184F1000879B1 /* PBXContainerItemProxy */;
+ fileType = wrapper.framework;
+ path = RestKit.framework;
+ remoteRef = 2534806A14F941A900565CED /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
- 25D63960135184F1000879B1 /* libRestKitJSONParserSBJSON.a */ = {
+ 2534806D14F941A900565CED /* RestKitFrameworkTests.octest */ = {
isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitJSONParserSBJSON.a;
- remoteRef = 25D6395F135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D63962135184F1000879B1 /* libRestKitJSONParserJSONKit.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitJSONParserJSONKit.a;
- remoteRef = 25D63961135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D63964135184F1000879B1 /* libRestKitXMLParserLibxml.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitXMLParserLibxml.a;
- remoteRef = 25D63963135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D63966135184F1000879B1 /* libRestKitCoreData.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitCoreData.a;
- remoteRef = 25D63965135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D63968135184F1000879B1 /* libRestKitThree20.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitThree20.a;
- remoteRef = 25D63967135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D6396A135184F1000879B1 /* RestKitSpecs.app */ = {
- isa = PBXReferenceProxy;
- fileType = wrapper.application;
- path = RestKitSpecs.app;
- remoteRef = 25D63969135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25FB6DA013E4848200F48969 /* libRestKitJSONParserNXJSON.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitJSONParserNXJSON.a;
- remoteRef = 25FB6D9F13E4848200F48969 /* PBXContainerItemProxy */;
+ fileType = wrapper.cfbundle;
+ path = RestKitFrameworkTests.octest;
+ remoteRef = 2534806C14F941A900565CED /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

0 comments on commit e66f65b

Please sign in to comment.