获取手机设备号及型号的宏

时间:2021-06-23 18:34:11

代码宏定义如下

 

//设备号
#define hUUID          [[UIDevice currentDevice].identifierForVendor.UUIDString stringByReplacingOccurrencesOfString:@"-" withString:@""]
//手机型号
#define hDeviceModel  [UIDevice currentDevice].model
//版本号获取
#define hAPPVersion    [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
//Build号获取
#define hAPPBuild      [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
//设备系统版本号
#define hDeviceVersion ([[UIDevice currentDevice] systemVersion])

#define hScreenWidth   [NSString stringWithFormat:@"%.1f",[[UIScreen mainScreen] bounds].size.width*[UIScreen mainScreen].scale]
#define hScreenHeight  [NSString stringWithFormat:@"%.1f",[[UIScreen mainScreen] bounds].size.height*[UIScreen mainScreen].scale]
//平台
#define hPlatform      @"iOS"