区分iPhone 4和iPhone 4S [英] Distinguish between iPhone 4 and iPhone 4S

查看:106
本文介绍了区分iPhone 4和iPhone 4S的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要区分iPhone 4S和iPhone 4.我浏览了帖子并获得了以下代码。如果这是唯一的方法,请告诉我,如果使用的话确认Apple没有问题。

I need to distinguish iPhone 4S from iPhone 4. I went through the posts and got the following code. Please let me know if this is the only way of doing it and confirm that there is no problem by Apple if used.

            struct utsname systemInfo;
            uname(&systemInfo);
            NSString *iPhoneVersion = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];

对于4S,iPhoneVersion字符串会给我iPhone4,1和iPhone 4会说iPhone3,1。

For 4S, iPhoneVersion string will give me iPhone4,1 and iPhone 4 will say iPhone3,1.

感谢您的建议。

推荐答案

iPhone 4也可能被调用对于CDMA型号, iPhone3,3 这里是一个不太新的列表)。一般来说,测试平台的功能(例如 [someSystemClass respondsToSelector:@selector(someMethodName)] 或类似)更安全且向前兼容而不是手动根据设备型号确定功能。你能说出为什么需要区分iPhone 4和4S吗?

iPhone 4 may also be called iPhone3,3 in the case of the CDMA model (here is a not-quite-up-to-date list). In general it is much safer and "forward compatible" to test for the capabilities of the platform (e.g. [someSystemClass respondsToSelector:@selector(someMethodName)] or similar) rather than manually determining the capabilities based on the device model. Could you say why you need to distinguish between iPhone 4 and 4S?

这篇关于区分iPhone 4和iPhone 4S的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆