iphone - 如何检查iPhone是否支持CDMA或GSM

标签 iphone ios4 gsm cellular-network cdma

有什么方法可以识别iPhone是否支持CDMA或GSM网络。 Objective-C 中的任何 Apple API 都可以提供此信息。

最佳答案

您可以使用函数 ( credits ) 检查模型 ID:

#include <sys/types.h>
#include <sys/sysctl.h>
NSString* machine () {
        size_t size;

            // Set 'oldp' parameter to NULL to get the size of the data
            // returned so we can allocate appropriate amount of space
        sysctlbyname("hw.machine", NULL, &size, NULL, 0); 

            // Allocate the space to store name
        char *name = malloc(size);

            // Get the platform name
        sysctlbyname("hw.machine", name, &size, NULL, 0);

            // Place name into a string
        NSString *machineid = [NSString stringWithUTF8String:name];

            // Done with this
        free(name);

        return machineid;
    }

函数将返回类似 @"iPhone3,3"的字符串,它代表 iPhone 4 (CDMA/Verizon)。收集各种型号的完整表格可能很困难。部分型号描述可参见 here 。当新模型出现时,您必须扩展模型表。

关于iphone - 如何检查iPhone是否支持CDMA或GSM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7596079/

相关文章:

iphone - 使用自定义核心数据持久存储通过 web 服务获取数据?

iphone - 应用不同的过滤器

iOS - UncaughtExceptions 全局异常处理程序不允许应用程序退出

terminal - 如何通过GSM调制解调器从Mac终端发送短信?

arduino - SIM900 GSM/GPRS 未获得正确的 AT+CREG?回答

iphone - Table View的带有图片的标题在iPhone 5中不起作用

ios - 如何修复 UITableView Accessibility 在滚动时说错语言?

iphone - iPhone开发中如何提高代码规范水平?

iPhone : How to check whether a substring exists in a string?

android - 一些 GSM 设备在 Android 上因 CDMA SignalStrength 错误而崩溃