获取app相关的信息

OC
app信息

NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];  
CFShow(infoDictionary);  

NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];   // app名称  
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];   // app版本  
NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];   // app build版本      
NSString *appCurName = [infoDictionary objectForKey:@"CFBundleDisplayName"];  // 当前应用名称  
NSString *appCurVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];  // 当前应用软件版本  比如:1.0.1  
NSString *appCurVersionNum = [infoDictionary objectForKey:@"CFBundleVersion"]; // 当前应用版本号码   int类型   

设备信息

NSString* identifierNumber = [[UIDevice currentDevice] uniqueIdentifier];    //手机序列号  
NSString* userPhoneName = [[UIDevice currentDevice] name];  //手机别名: 用户定义的名称 
NSString* deviceName = [[UIDevice currentDevice] systemName];   //设备名称  
NSString* phoneVersion = [[UIDevice currentDevice] systemVersion];   //手机系统版本   
NSString* phoneModel = [[UIDevice currentDevice] model];    //手机型号  
NSString* localPhoneModel = [[UIDevice currentDevice] localizedModel];   //地方型号  (国际化区域名称)

swift
app信息

let infoDictionary = Bundle.main.infoDictionary 

let appDisplayName: String = Bundle.main.infoDictionary!["CFBundleDisplayName"] as! String //App 名称
let appVersion:String = Bundle.main.infoDictionary! ["CFBundleShortVersionString"] as! String// App 版本号
let buildVersion : String = Bundle.main.infoDictionary! ["CFBundleVersion"] as! String //Bulid 版本号
let bundleIdentifier:String = Bundle.main.bundleIdentifier! // Bundle Identifier

设备信息

let iOSVersion:String = UIDevice.current.systemVersion //ios 版本
let identifierNumber = UIDevice.current.identifierForVendor //设备 udid
let systemName = UIDevice.current.systemName //设备名称
let model = UIDevice.current.model // 设备型号
let localizedModel = UIDevice.current.localizedModel  //设备区域化型号

你可能感兴趣的:(获取app相关的信息)