iOS 有关手机信息的查询
2018-04-18 本文已影响0人
CoderKevinChan
在开发中有项目需求,我们会用到手机相关的一些信息
1.手机系统版本:
CGFloat version = [[[UIDevice currentDevice] systemVersion ] floatValue];
2.获取UUID
NSString *identifierStr = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
3. 当前应用软件版本 比如:1.0.1
NSString *appCurVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
4.手机物理尺寸
CGRect rect = [[UIScreen mainScreen] bounds];
CGSize size = rect.size;
CGFloat width = size.width;
CGFloat height = size.height;
NSLog(@"物理尺寸:%.0f × %.0f",width,height);
5.手机分辨率
CGFloat scale_screen = [UIScreen mainScreen].scale;
NSLog(@"分辨率是:%.0f × %.0f",width*scale_screen ,height*scale_screen);