首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何检查iPhone是否支持CDMA或GSM?

如何检查iPhone是否支持CDMA或GSM?
EN

Stack Overflow用户
提问于 2011-09-29 18:39:11
回答 1查看 5.7K关注 0票数 2

有没有办法确定iPhone是否支持CDMA或GSM网络?Objective-C中任何可以提供此信息的Apple API。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-09-29 18:54:02

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

代码语言:javascript
复制
#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中找到。当新的模型出现时,你必须扩展模型表。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7596079

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档