获取APP版本号
程序员文章站
2022-05-19 22:10:29
...
var appVersion: String {
var result = ""
if let info = Bundle.main.infoDictionary {
if let version = info["CFBundleShortVersionString"] as? String {
result = version
if let build = info["CFBundleVersion"] as? String {
result = "V" + version + " (Build " + build + ")"
}
} else {
result = "V1.0.0 (Build 1)"
}
}
return result
}