[iOS] Get Ver and Build number in code

嗯,最近在做ios,想把ver和build number放代码里,在SO上找到了这个办法,贴过来备存

let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
let appBundle = Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as! String

ObjC的见原贴

你可能感兴趣的:([iOS] Get Ver and Build number in code)