获取当前设备的型号,不依据屏幕size判断设备型号 如iPhone6 对应的deviceModelString: iPhone7,2
//需#import "sys/utsname.h"
- (NSString*)deviceModelString
{
struct utsname deviceInfo;
uname(&deviceInfo);
NSString * deviceModel = [NSString stringWithCString:deviceInfo.machine encoding:NSUTF8StringEncoding];
return deviceModel;
}
// NSString * model = [[UIDevice currentDevice] model]; 该方法只能判断 设备的类型(@"iPhone", @"iPod touch"),无法判断具体型号
时间: 2025-01-18 13:14:27