IOS获取当前版本号 Bundle ID等信息的方法详解

复制代码
本人亲测有效!更多交流可以家魏鑫:lixiaowu1129,公重好:iOS过审汇总,一起探讨iOS技术!

IOS获取当前版本号 Bundle ID等信息的方法

1:获取bundle Id信息:[[NSBundle mainBundle]bundleIdentifier];

2:获取版本号:[[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleShortVersionString"];

3:获取build号:[[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleVersion"];

4:获取App显示名:[[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleDisplayName"];

其实 [[NSBundle mainBundle]infoDictionary] 获得的是一个字典,里边放着Info.plist文件中的各种信息,根据不同的键去即可,如:

objectivec 复制代码
CFBundleDevelopmentRegion 

  CFBundleDisplayName 

  CFBundleExecutable

  CFBundleExecutablePath

  CFBundleIdentifier

  CFBundleInfoDictionaryVersion = "6.0";

  CFBundleInfoPlistURL

  CFBundleName

  CFBundlePackageType 

  CFBundleShortVersionString

  CFBundleSignature 

 CFBundleSupportedPlatforms
相关推荐
泉木12 小时前
Swift 从入门到精通-第三篇
swift
毛骗导演14 小时前
万字解析 OpenClaw 源码架构-跨平台应用之 iOS 应用
前端·ios·架构
songgeb15 小时前
Buildable Folder & Group & Folder Reference in Xcode
xcode·swift
鹏多多.1 天前
Flutter使用screenshot进行截屏和截长图以及分享保存的全流程指南
android·前端·flutter·ios·前端框架
少云清1 天前
【UI自动化测试】1_IOS自动化测试 _环境搭建
ui·ios
yijianxiangde1001 天前
iOS 无根越狱前期准备
ios
库奇噜啦呼1 天前
【iOS】Effective Objective-C第一章
开发语言·ios·objective-c
songgeb1 天前
UITableView 在 width=0 时 reloadData 被"空转消费"导致 Cell 显示错乱
swift·cursor
2501_916008891 天前
iPhone 上怎么抓 App 的网络请求,在 iOS 设备上捕获网络请求
android·网络·ios·小程序·uni-app·iphone·webview
他们都不看好你,偏偏你最不争气1 天前
【iOS】block
开发语言·ios·objective-c·block·闭包