您的位置:首页 > 移动开发 > IOS开发

IOS 获取系统信息

2016-05-22 18:48 363 查看
IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等

// app名称

NSString *app_Name1 = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];

NSString *app_Name = [NSString stringWithFormat:@"%@",[[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleNameKey]];

NSString *app_Name2 = [NSString stringWithFormat:@"%@",[[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleExecutableKey]];

NSLog(@"==============1%@-----%@---%@",app_Name1,app_Name,app_Name2);

// app版本

NSString *app_Version1 = [NSString stringWithFormat:@"v%@",
[[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString*) kCFBundleVersionKey]];

NSString *app_Version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];

NSLog(@"==============1%@---%@",app_Version1,app_Version);

// app build版本

NSString *app_build1 = [NSString stringWithFormat:@"v%@",
[[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString*)kCFBundleVersionKey]];

NSString *app_build = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];

NSLog(@"==============1%@---%@",app_build1,app_build);

//ios获取系统信息

//NSLog(@"identifier: %@", [[UIDevice currentDevice] identifierForVendor]);

//NSLog(@"name: %@", [[UIDevice currentDevice] name]);

//NSLog(@"systemName: %@", [[UIDevice currentDevice] systemName]);

//NSLog(@"systemVersion: %@", [[UIDevice currentDevice] systemVersion]);

//NSLog(@"model: %@", [[UIDevice currentDevice] model]);

//NSLog(@"localizedModel: %@", [[UIDevice currentDevice] localizedModel]);

[[UIScreen mainScreen] scale]详解

当屏幕分别为640x940时[[UIScreen mainScreen] scale]=2.0

当屏幕分别为320x480时[[UIScreen mainScreen] scale]=1.0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: