获取版本号[[NSBundle mainBundle] infoDictionary]
来源:互联网 发布:netstat查看端口占用 编辑:程序博客网 时间:2024/04/19 14:42
很多朋友改版本号,通过改变属性,比如说self.versionLabel = @”1.0”,版本更新后,self.versionLabel = @”1.1”
如果通过这样改,那就很麻烦了。但是如果通过代码获取info的version信息,那就很方便,以后版本更换后,只需要改变info的version,就可以了。
//获取当前版本号
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary]; NSLog(@"%@",infoDic); NSString *currentAppVersion = infoDic[@"CFBundleShortVersionString"];
infoDic包含如下所有的信息:也就是我们的程序信息:
{
BuildMachineOSBuild = 15C50;
CFBundleDevelopmentRegion = en;
CFBundleExecutable = ZYGLaunchIntroductionDemo;
CFBundleIdentifier = “com.huaxinlongma.ZYGLaunchIntroductionDemo”;
CFBundleInfoDictionaryVersion = “6.0”;
CFBundleInfoPlistURL = “Info.plist – file:///Users/lanouhn/Library/Developer/CoreSimulator/Devices/84454B75-C87C-4752-A24B-095EAAC00443/data/Containers/Bundle/Application/09AB9754-B19E-4F63-869B-B8D6C319EE85/ZYGLaunchIntroductionDemo.app/”;
CFBundleName = ZYGLaunchIntroductionDemo;
CFBundleNumericVersion = 16809984;
CFBundlePackageType = APPL;
CFBundleShortVersionString = “1.0”;
CFBundleSignature = “????”;
CFBundleSupportedPlatforms = (
iPhoneSimulator
);
CFBundleVersion = 1;
DTCompiler = “com.apple.compilers.llvm.clang.1_0”;
DTPlatformBuild = “”;
DTPlatformName = iphonesimulator;
DTPlatformVersion = “9.2”;
DTSDKBuild = 13C75;
DTSDKName = “iphonesimulator9.2”;
DTXcode = 0720;
DTXcodeBuild = 7C68;
LSRequiresIPhoneOS = 1;
MinimumOSVersion = “8.1”;
UIDeviceFamily = (
1
);
UILaunchStoryboardName = LaunchScreen;
UIRequiredDeviceCapabilities = (
armv7
);
UISupportedInterfaceOrientations = (
UIInterfaceOrientationPortrait,
UIInterfaceOrientationLandscapeLeft,
UIInterfaceOrientationLandscapeRight
);
}
- 获取版本号[[NSBundle mainBundle] infoDictionary]
- 获取版本号[[NSBundle mainBundle] infoDictionary]
- [[NSBundle mainBundle] infoDictionary]
- [[NSBundle mainBundle] infoDictionary]
- [[NSBundle mainBundle] infoDictionary]
- [NSBundle mainBundle] infoDictionary
- IOS开发之 [[NSBundle mainBundle] infoDictionary]
- IOS开发: NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]
- 关于[[NSBundle mainBundle] infoDictionary]里面的那些东西
- [NSBundle mainBundle] pathForResource: ofType: 获取不到数据
- [NSBundle mainBundle] pathForResource: ofType: 获取不到数据
- NSBundle、[NSBundle mainBundle] 详解
- UI中关于NSBundle mainBundle获取不到数据解决方案
- [[NSBundle mainBundle]pathForResource:@"name" ofType:@"type"] 获取不到本地文件
- [NSBundle mainBundle] 详解
- NSBundle以及mainBundle
- [NSBundle mainBundle] 详解
- NSBundle mainBundle
- Java Executor并发框架(六)Executor框架线程池任务执行全过程(上)
- COCOS2DX 在vs上编译.cpp文件报错 error C2065: “”: 未声明的标识符
- browser-sync自动刷新-前端利器
- TypeError: cannot use a string pattern on a bytes-like object解决方法
- JSON-RPC(jsonrpc4j)使用demo
- 获取版本号[[NSBundle mainBundle] infoDictionary]
- C++加载csb文件
- redis 学习笔记(1)-编译、启动、停止
- python 正则表达式
- Android学习笔记—— EventBus 源码解析
- android 调用webservice保持session
- JSON-RPC轻量级远程调用协议介绍及使用
- 工作心得
- Calendar的用法