如何检查 iPhone 是否支持 CDMA 或 GS​​M [英] How to check if iPhone supports CDMA or GSM

查看:17
本文介绍了如何检查 iPhone 是否支持 CDMA 或 GS​​M的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以确定 iPhone 是否支持 CDMA 或 GS​​M 网络.任何可以提供此信息的 Objective-C 中的 Apple API.

Is there any way to identify if iPhone supports CDMA or GSM network. Any Apple API in Objective-C which can provide this information.

推荐答案

您可以使用函数 (学分):

You might examine model id with the function (credits):

#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).收集各种型号的完整表格可能很困难.部分型号说明可在此处找到.随着新模型的出现,您必须展开模型表.

Function will return string like @"iPhone3,3" which stands for iPhone 4 (CDMA/Verizon). It might be difficult to gather full table of various model numbers. Some of the models descriptions could be found here. You'll have to expand table of models as new models will appear.

这篇关于如何检查 iPhone 是否支持 CDMA 或 GS​​M的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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