iPhone 判断运营商

- (NSString *)getCarrier
{
    NSString *strCarrier = nil;
    CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfo alloc] init];
    CTCarrier *carrier = [networkInfo subscriberCellularProvider];
    if (carrier == nil)
    {
        [networkInfo release];
        return strCarrier;
    }
    
    NSString *code = [carrier mobileNetworkCode];
    if (code == nil)
    {
        [networkInfo release];
        return strCarrier;
    }
    
    // 根据mobileNetworkCode判断运营商
    if ([code isEqualToString:@"00"] || [code isEqualToString:@"02"] || [code isEqualToString:@"07"])
        strCarrier = @"中国移动";
    else if ([code isEqualToString:@"01"] || [code isEqualToString:@"06"])
        strCarrier = @"中国联通";
    else if ([code isEqualToString:@"03"] || [code isEqualToString:@"05"])
        strCarrier = @"中国电信";
    else if ([code isEqualToString:@"20"])
        strCarrier = @"中国铁通";
    else
        strCarrier = nil;
    
    [networkInfo release];
    
    return strCarrier;
}


China - CN

MCC MNC Brand Operator Status Bands (MHz) References and notes
460 00 China Mobile China Mobile Operational GSM 900 / GSM 1800 / TD-SCDMA 1880 / TD-SCDMA 2010
460 01 China Unicom China Unicom Operational GSM 900 / GSM 1800 / UMTS 2100 CDMA network sold to China Telecom, WCDMA commercial trial started in May 2009 and in full commercial operation as of October 2009.
460 02 China Mobile China Mobile Operational GSM 900 / GSM 1800 / TD-SCDMA 1880 / TD-SCDMA 2010  
460 03 China Telecom China Telecom Operational CDMA2000 800 / CDMA2000 2100 EV-DO
460 05 China Telecom China Telecom Operational    
460 06 China Unicom China Unicom Operational GSM 900 / GSM 1800 / UMTS 2100  
460 07 China Mobile China Mobile Operational GSM 900 / GSM 1800 / TD-SCDMA 1880 / TD-SCDMA 2010  
460 20 China Tietong China Tietong Operational GSM-R  

[edit]

详细参考:http://en.wikipedia.org/wiki/Mobile_Network_Code

你可能感兴趣的:(iPhone 判断运营商)