Created
July 3, 2013 20:44
-
-
Save thetzel/5922639 to your computer and use it in GitHub Desktop.
Fork app in main.m between old codebase for iOS5/6 and new for iOS7+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSUInteger DeviceSystemMajorVersion(); | |
NSUInteger DeviceSystemMajorVersion() { | |
static NSUInteger _deviceSystemMajorVersion = -1; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
_deviceSystemMajorVersion = [[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."] objectAtIndex:0] intValue]; | |
}); | |
return _deviceSystemMajorVersion; | |
} | |
#define OLDSCHOOL (DeviceSystemMajorVersion() < 7) | |
int main(int argc, char *argv[]) { | |
if (OLDSCHOOL) { | |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate"); | |
[pool release]; | |
return retVal; | |
} | |
else | |
{ | |
@autoreleasepool { | |
return UIApplicationMain(argc, argv, nil, @"FlatAppDelegate"); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment