获取当前手机的运营商等信息

+(NSString*)getCellularProviderName

{

 

    CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc]init];

 

    CTCarrier*carrier = [netInfo subscriberCellularProvider];

    [netInfo release];

    NSLog(@"carrier:%@",carrier);

    NSString * imsi=@"";

    if (carrier!=NULL) {

    NSMutableDictionary *dic=[[NSMutableDictionary alloc] init];

    [dic setObject:[[[carrier carrierName] retain]autorelease] forKey:@"Carriername"];

    [dic setObject:[carrier mobileCountryCode] forKey:@"MobileCountryCode"];

    [dic setObject:[carrier mobileNetworkCode]forKey:@"MobileNetworkCode"];

    [dic setObject:[carrier isoCountryCode] forKey:@"ISOCountryCode"];

    [dic setObject:[carrier allowsVOIP]?@"YES":@"NO" forKey:@"AllowsVOIP"];

    imsi=[JSONDecoder NSDictionaryJSONString:dic];

    [dic release];

        }

 

    return imsi;//cellularProviderName;

 

}


你可能感兴趣的:(iPhone,IMSI,运行商)