iOS获取版本号

app名称:

NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];

获取系统版本:

NSString * systemVersion = [UIDevice currentDevice].systemVersion;//10.0.2CGFloat 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"]

http://upload-images.jianshu.io/upload_images/1864695-02861d9e4b48cef3.png?imageMogr2/auto-orient/strip%7CimageView2/2

http://upload-images.jianshu.io/upload_images/1864695-4c16e04cc8b0a8c2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240

作者:iOS_feeling链接:http://www.jianshu.com/p/d2332cfd1d60來源:著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

你可能感兴趣的:(iOS获取版本号)