【问题标题】:Is it possible to get the specific iPhone model number? [duplicate]是否可以获得特定的 iPhone 型号? [复制]
【发布时间】:2013-01-06 06:43:04
【问题描述】:

可能重复:
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 中,还是有更简单的方法可以找到?

【问题讨论】:

标签: iphone ios xcode version


【解决方案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

【讨论】:

    猜你喜欢
    • 2013-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-22
    • 1970-01-01
    • 1970-01-01
    • 2012-04-20
    相关资源
    最近更新 更多