Skip to content

Instantly share code, notes, and snippets.

@naokits
Created August 21, 2013 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naokits/6295029 to your computer and use it in GitHub Desktop.
Save naokits/6295029 to your computer and use it in GitHub Desktop.
get os, app, build version info
- (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