[objc/swift]アプリケーションバージョン、バージョンコード情報のインポート
objc:
https://stackoverflow.com/questions/24501288/getting-version-and-build-information-with-swift
+ (NSString*) getAppVersionName
{
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
}
+ (NSString*) getAppBuildVersionCode
{
return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
}
swift:var version: String? {
guard let dictionary = Bundle.main.infoDictionary,
let version = dictionary["CFBundleShortVersionString"] as? String,
let build = dictionary["CFBundleVersion"] as? String else {return nil}
let versionAndBuild: String = "vserion: \(version), build: \(build)"
return versionAndBuild
}
ソースhttps://stackoverflow.com/questions/24501288/getting-version-and-build-information-with-swift
Reference
この問題について([objc/swift]アプリケーションバージョン、バージョンコード情報のインポート), 我々は、より多くの情報をここで見つけました https://velog.io/@james-chun-dev/objcswift-앱버전-버전코드-정보-가져오기テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol