是否有可能获得特定的iPhone型号?

时间:2013-01-22 21:51:03

标签: iphone ios xcode version

  

可能重复:
  Determine device (iPhone, iPod Touch) with iPhone SDK
  How to find iPhone/iPod Device model(3G,3GS,4,4S) by code?

我知道有一种方法可以使用命令[[UIDevice currentDevice] model]或[[UIDevice currentDevice] localizedModel]获取手机的型号和本地化型号,但是在几台iPhone上,两个命令都会生成相同的结果,这是“iPhone”(或所有iPad的“iPad”)。

我希望找到一种方法来检测设备是iPhone 3,3S,4,4S还是5(或iPad 1,2等)。这个值是否隐藏在uniqueIdentifier中,或者是否有更简单的方法来查找它?

1 个答案:

答案 0 :(得分:1)

来自this iphonedevsdk post

#import <sys/utsname.h>

struct utsname u;
uname(&u);

NSString *nameString =  [NSString stringWithCString:u.machine encoding:NSUTF8StringEncoding];    

同时检查this blog "iPhone @2x Graphics, scale, and iPad"this list of identifiers

相关问题