- (NSString*)checkCarrier
{
NSString *ret = [[NSString alloc]init];
CTTelephonyNetworkInfo *info = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [info subscriberCellularProvider];
if (carrier == nil) {
return @"0";
}
NSString *code = [carrier mobileNetworkCode];
if ([code isEqual: @""]) {
return @"0";
}
if ([code isEqualToString:@"00"] || [code isEqualToString:@"02"] || [code isEqualToString:@"07"]) {
ret = @"移动";
}
if ([code isEqualToString:@"01"]|| [code isEqualToString:@"06"] ) {
ret = @"联通";
}
if ([code isEqualToString:@"03"]|| [code isEqualToString:@"05"] ) {
ret = @"电信";;
}
NSLog(@"%@",ret);
return ret;
}
时间: 2024-10-04 18:30:28