How to check if iPhone supports CDMA or GSM(如何检查 iPhone 是否支持 CDMA 或 GSM)
问题描述
有什么方法可以确定 iPhone 是否支持 CDMA 或 GSM 网络.任何可以提供此信息的 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 或 GSM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何检查 iPhone 是否支持 CDMA 或 GSM


基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01