macOS 获取版本信息

2022-10-11  本文已影响0人  木马不在转
一:获取软件版本号
let appVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString")
二:获取系统信息
// 直接获取大版本
let sys1Version = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion")
// 更加详细
let sys2Version = NSDictionary(contentsOfFile: "/System/Library/CoreServices/SystemVersion.plist")
上一篇下一篇

猜你喜欢

热点阅读