是否可以确定iPhone 4s的网络类型(GSM / CDMA)? 有没有办法确定iPhone 4s的网络类型(GSM / CDMA)。我想尽可能区分GSM / WCDMA和CDMA。我使用以下代码来检测它。
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = malloc(size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
NSString *platform = [NSString stringWithUTF8String:machine];
if ([platform isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
if ([platform isEqualToString:@"iPhone4,3"]) return @"iPhone 4S coma";
但我用我的昏迷和wcdma iphone4s测试它。 它都归还iPhone4,1。我无法区分它。
答案 0 :(得分:0)
您可以使用正在用作指标的载体。
NSString* networkType = nil;
// Setup the Network Info and create a CTCarrier object
// first check to ensure the developper linked the CoreTelephony framework
Class telephonyClass = NSClassFromString(@"CTTelephonyNetworkInfo");
if ( nil != telephonyClass ) {
CTTelephonyNetworkInfo *networkInfo = [[[telephonyClass alloc] init] autorelease];
if ( nil != networkInfo ) {
// Get mobile network code
NSString *mnc = [carrier mobileNetworkCode];
if (mnc != nil) {
// set networkType based on carrier name
// carrier name to network type mapping left as an exercise for the reader
//
}
}
}