//MARK: 判断应用是否是第一次启动
static func isFirstLaunch() -> Bool {
let infoDic = Bundle.main.infoDictionary
if let dic = infoDic {
//获取当前应用的版本号
let currentAppVersion = "\(dic["CFBundleShortVersionString"] ?? "")"
//获取上次启动应用保存的appVersion
let version = "\(UserDefaults.standard.object(forKey: "kAppVersion") ?? "")"
//版本升级或者首次登陆
if version != currentAppVersion {
UserDefaults.standard.setValue(currentAppVersion, forKey: "kAppVersion")
return true
} else {
return false
}
} else {
return false
}
}
end