Ios 以编程方式更改模拟器中的设备类型时,如何获取设备名称?

Ios 以编程方式更改模拟器中的设备类型时,如何获取设备名称?,ios,iphone,device-name,Ios,Iphone,Device Name,我使用以下方法: #import <sys/utsname.h> // import it in your header or implementation file. NSString* deviceName() { struct utsname systemInfo; uname(&systemInfo); return [NSString stringWithCString:systemInfo.machine

我使用以下方法:

#import <sys/utsname.h> // import it in your header or implementation file.

NSString* deviceName()
{
    struct utsname systemInfo;
    uname(&systemInfo);

    return [NSString stringWithCString:systemInfo.machine
                              encoding:NSUTF8StringEncoding];
}
我总是得到
x86\u 64
。但是当我选择4s模拟器时,我希望得到iphone4;当我选择iPhone6模拟器时,我希望得到iPhone6


有没有办法做到这一点?

请查看这里的大量答案,但所有答案都只给出了“模拟器”这一常见结果。我的要求是选择型号(如模拟器iPhone4、模拟器iPhone6等)。希望你能让我在设备中正常工作。但是没有在模拟器中得到名字。
@"i386"      on 32-bit Simulator
@"x86_64"    on 64-bit Simulator
@"iPod1,1"   on iPod Touch
@"iPod2,1"   on iPod Touch Second Generation
@"iPod3,1"   on iPod Touch Third Generation
@"iPod4,1"   on iPod Touch Fourth Generation
@"iPhone1,1" on iPhone
@"iPhone1,2" on iPhone 3G
@"iPhone2,1" on iPhone 3GS
@"iPad1,1"   on iPad
@"iPad2,1"   on iPad 2
@"iPad3,1"   on 3rd Generation iPad
@"iPhone3,1" on iPhone 4
@"iPhone4,1" on iPhone 4S
@"iPhone5,1" on iPhone 5 (model A1428, AT&T/Canada)
@"iPhone5,2" on iPhone 5 (model A1429, everything else)
@"iPad3,4" on 4th Generation iPad
@"iPad2,5" on iPad Mini
@"iPhone5,3" on iPhone 5c (model A1456, A1532 | GSM)
@"iPhone5,4" on iPhone 5c (model A1507, A1516, A1526 (China), A1529 | Global)
@"iPhone6,1" on iPhone 5s (model A1433, A1533 | GSM)
@"iPhone6,2" on iPhone 5s (model A1457, A1518, A1528 (China), A1530 | Global)
@"iPad4,1" on 5th Generation iPad (iPad Air) - Wifi
@"iPad4,2" on 5th Generation iPad (iPad Air) - Cellular
@"iPad4,4" on 2nd Generation iPad Mini - Wifi
@"iPad4,5" on 2nd Generation iPad Mini - Cellular
@"iPhone7,1" on iPhone 6 Plus
@"iPhone7,2" on iPhone 6