根据某些特定需求,需要展示当前设备的型号信息
// 获取uuid
+ (NSString *)getMineUUID {
KeychainItemWrapper *keychain=[[KeychainItemWrapper alloc] initWithIdentifier:@"fifteenUUID" accessGroup:nil];
NSString *UUID = [keychain objectForKey:(id)kSecValueData];
if (!([UUID isKindOfClass:[NSString class]] && [UUID isNoEmpty])) {
UUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
[keychain setObject:UUID forKey:(id)kSecValueData];
}
return UUID;
}
// 获取iPhone型号
+(NSString *)getPlatformInfo {
struct utsname systemInfo;
uname(&systemInfo);
NSString *platform = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
if ([platform isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
if ([platform isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
if ([platform isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
if ([platform isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
if ([platform isEqualToString:@"iPhone8,4"]) return @"iPhone SE";
if ([platform isEqualToString:@"iPhone9,1"]) return @"iPhone 7";
if ([platform isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";
if ([platform isEqualToString:@"iPhone10,1"]) return @"iPhone 8";
if ([platform isEqualToString:@"iPhone10,4"]) return @"iPhone 8";
if ([platform isEqualToString:@"iPhone10,2"]) return @"iPhone 8 Plus";
if ([platform isEqualToString:@"iPhone10,5"]) return @"iPhone 8 Plus";
if ([platform isEqualToString:@"iPhone10,3"]) return @"iPhone X";
if ([platform isEqualToString:@"iPhone10,6"]) return @"iPhone X";
if ([platform isEqualToString:@"iPhone11,8"]) return @"iPhone XR";
if ([platform isEqualToString:@"iPhone11,2"]) return @"iPhone XS";
if ([platform isEqualToString:@"iPhone11,6"]) return @"iPhone XS Max";
if ([platform isEqualToString:@"iPhone11,4"]) return @"iPhone XS Max";
if ([platform isEqualToString:@"iPhone12,1"]) return @"iPhone 11";
if ([platform isEqualToString:@"iPhone12,3"]) return @"iPhone 11 Pro";
if ([platform isEqualToString:@"iPhone12,5"]) return @"iPhone 11 Pro Max";
if ([platform isEqualToString:@"iPhone12,8"]) return @"iPhone SE";
if ([platform isEqualToString:@"iPhone13,1"]) return @"iPhone 12 mini";
if ([platform isEqualToString:@"iPhone13,2"]) return @"iPhone 12";
if ([platform isEqualToString:@"iPhone13,3"]) return @"iPhone 12 Pro";
if ([platform isEqualToString:@"iPhone13,4"]) return @"iPhone 12 Pro Max";
if ([platform isEqualToString:@"iPhone14,4"]) return @"iPhone 13 mini";
if ([platform isEqualToString:@"iPhone14,5"]) return @"iPhone 13";
if ([platform isEqualToString:@"iPhone14,2"]) return @"iPhone 13 Pro";
if ([platform isEqualToString:@"iPhone14,3"]) return @"iPhone 13 Pro Max";
if ([platform isEqualToString:@"iPhone14,6"]) return @"iPhone SE3";
if ([platform isEqualToString:@"iPhone14,7"]) return @"iPhone 14";
if ([platform isEqualToString:@"iPhone14,8"]) return @"iPhone 14 Plus";
if ([platform isEqualToString:@"iPhone15,2"]) return @"iPhone 14 Pro";
if ([platform isEqualToString:@"iPhone15,3"]) return @"iPhone 14 Pro Max";
if ([platform isEqualToString:@"iPhone15,4"]) return @"iPhone 15";
if ([platform isEqualToString:@"iPhone15,5"]) return @"iPhone 15 Plus";
if ([platform isEqualToString:@"iPhone16,1"]) return @"iPhone 15 Pro";
if ([platform isEqualToString:@"iPhone16,2"]) return @"iPhone 15 Pro Max";
if ([platform isEqualToString:@"iPhone17,3"]) return @"iPhone_16";
if ([platform isEqualToString:@"iPhone17,4"]) return @"iPhone_16_Plus";
if ([platform isEqualToString:@"iPhone17,1"]) return @"iPhone_16_Pro";
if ([platform isEqualToString:@"iPhone17,2"]) return @"iPhone_16_Pro_Max";
return @"iPhone";
}
// 例如 iOS
+(NSString *)getSystemName {
return UIDevice.currentDevice.systemName;
}
// 例如iPhone18.1系统
+(NSString *)getSystemVersion {
return UIDevice.currentDevice.systemVersion;
}