1.导入
#import
//MARK: 获取设备型号
+ (NSString *)currentPhoneModel {
struct utsname systemInfo;
uname(&systemInfo);
NSString *phoneModel = [NSString stringWithCString: systemInfo.machine encoding:NSASCIIStringEncoding];
if ([phoneModel isEqualToString:@"iPhone3,1"] ||
[phoneModel isEqualToString:@"iPhone3,2"]) return @"iPhone 4";
if ([phoneModel isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
if ([phoneModel isEqualToString:@"iPhone5,1"] ||
[phoneModel isEqualToString:@"iPhone5,2"]) return @"iPhone 5";
if ([phoneModel isEqualToString:@"iPhone5,3"] ||
[phoneModel isEqualToString:@"iPhone5,4"]) return @"iPhone 5C";
if ([phoneModel isEqualToString:@"iPhone6,1"] ||
[phoneModel isEqualToString:@"iPhone6,2"]) return @"iPhone 5S";
if ([phoneModel isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
if ([phoneModel isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
if ([phoneModel isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
if ([phoneModel isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
if ([phoneModel isEqualToString:@"iPhone8,4"]) return @"iPhone SE";
if ([phoneModel isEqualToString:@"iPhone9,1"]) return @"iPhone 7";
if ([phoneModel isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";
if ([phoneModel isEqualToString:@"iPhone10,1"] ||
[phoneModel isEqualToString:@"iPhone10,4"]) return @"iPhone 8";
if ([phoneModel isEqualToString:@"iPhone10,2"] ||
[phoneModel isEqualToString:@"iPhone10,5"]) return @"iPhone 8 Plus";
if ([phoneModel isEqualToString:@"iPhone10,3"] ||
[phoneModel isEqualToString:@"iPhone10,6"]) return @"iPhone X";
if ([phoneModel isEqualToString:@"iPhone11,8"]) return @"iPhone XR";
if ([phoneModel isEqualToString:@"iPhone11,2"]) return @"iPhone XS";
if ([phoneModel isEqualToString:@"iPhone11,6"] ||
[phoneModel isEqualToString:@"iPhone11,4"]) return @"iPhone XS Max";
return @"Unknown";
}
2.
//获取APP当前版本号
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
3.
//获取设备系统版本
[[UIDevice currentDevice] systemVersion];