app名称:
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
获取系统版本:
NSString * systemVersion = [UIDevice currentDevice].systemVersion;//10.0.2
CGFloat test = [[UIDevice currentDevice] systemVersion].floatValue;//10
iOS代码实现获得项目名称及版本号(Version/Build):
NSString *executableFile = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey];//获取项目名称
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey];//获取项目版本号
iOS的版本号,一个叫做Version,一个叫做Build,这两个值都可以在Xcode中选中target,点击"General"后看到。 Version在plist文件中的key是“CFBundleShortVersionString”,和AppStore上的版本号保持一致。
Build在plist中的key是“CFBundleVersion”,代表build的版本号,该值每次build之后都应该增加1。
//获得应用的Verison号:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
或
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
//获得build号:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]