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


基础教程推荐
- 固定小数的Android Money Input 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01