// 获取当前App的基本信息字典
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
//app名称
NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
// app版本
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
// app build版本
NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];
//手机序列号
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];
获取设备名称
OC代码
NSString *deviceName = [[UIDevice currentDevice] name];
Swift代码
let deviceName = UIDevice.currentDevice().name
获取系统版本号
OC代码
NSString *sysVersion = [[UIDevice currentDevice] systemVersion];
Swift代码
let sysVersion = UIDevice.currentDevice().systemVersion
获取设备唯一标识符
OC代码
NSString *deviceUUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
Swift代码
let deviceUUID = UIDevice.currentDevice().identifierForVendor?.UUIDString
获取设备的型号
OC代码
NSString *deviceModel = [[UIDevice currentDevice] model];
Swift代码
let deviceModel = UIDevice.currentDevice().model
获取App相关的信息
OC代码
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
// 获取App的版本号
NSString *appVersion = [infoDic objectForKey:@"CFBundleShortVersionString"];
// 获取App的build版本
NSString *appBuildVersion = [infoDic objectForKey:@"CFBundleVersion"];
// 获取App的名称
NSString *appName = [infoDic objectForKey:@"CFBundleDisplayName"];
Swift代码
let infoDic = NSBundle.mainBundle().infoDictionary
// 获取App的版本号
let appVersion = infoDic?["CFBundleShortVersionString"]
// 获取App的build版本
let appBuildVersion = infoDic?["CFBundleVersion"]
// 获取App的名称
let appName = infoDic?["CFBundleDisplayName"]
网友评论