Search This Blog

Thứ Hai, 19 tháng 11, 2018

Lấy phiên bản hiện tại trong ios

let appVersion = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as? String
//First get the nsObject by defining as an optional anyObject
let nsObject: AnyObject? = NSBundle.mainBundle().infoDictionary["CFBundleShortVersionString"]

//Then just cast the object as a String, but be careful, you may want to double check for nil
let version = nsObject as String

Không có nhận xét nào:

Đăng nhận xét