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找到。隨着新模型的出現,您將不得不展開模型表格。