Created
August 21, 2013 14:16
-
-
Save naokits/6295029 to your computer and use it in GitHub Desktop.
get os, app, build version info
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
- (void)osVersion | |
{ | |
NSString *targetVersion = @"6.0"; | |
NSString *osVersion = [[UIDevice currentDevice] systemVersion]; | |
NSLog(@"OSのバージョン:%@", osVersion); | |
if ([osVersion compare:targetVersion options:NSNumericSearch] == NSOrderedAscending) { | |
NSLog(@"iOS%@前のバージョン", osVersion); | |
} | |
if ([osVersion compare:targetVersion options:NSNumericSearch] == NSOrderedSame || | |
[osVersion compare:targetVersion options:NSNumericSearch] == NSOrderedDescending) { | |
NSLog(@"iOS%@以降のバージョン", targetVersion); | |
} | |
} | |
- (void)appVersion | |
{ | |
NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; | |
NSLog(@"アプリバージョン:%@", appVersion); | |
} | |
- (void)buildNumber | |
{ | |
NSString *build = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; | |
NSLog(@"ビルドバージョン:%@", build); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment