2
有什么方法可以确定iPhone是否支持CDMA或GSM网络。 Objective-C中的任何Apple API都可以提供此信息。如何检查iPhone是否支持CDMA或GSM
有什么方法可以确定iPhone是否支持CDMA或GSM网络。 Objective-C中的任何Apple API都可以提供此信息。如何检查iPhone是否支持CDMA或GSM
你可能会检查模型ID与功能(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公司)。收集各种型号的完整表格可能很困难。一些模型描述可以在here找到。随着新模型的出现,您将不得不展开模型表格。