IOS模拟器能获取运营商信息,网络连接类型以及地理位置吗?
来源:互联网 发布:java分布式架构概念 编辑:程序博客网 时间:2024/05/21 17:27
代码如下:
//获取运营商信息和网络连接类型
-(void)getCarrierInfoAndConnectType
{
CTTelephonyNetworkInfo* info = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier* carrier = [info subscriberCellularProvider];
if (carrier != NULL)
{
mCarrier = [carrier carrierName];
mConnectType = [carrier mobileNetworkCode];
}
NSLog(@"carrier:%@",mCarrier);
NSLog(@"connectype:%@",mConnectType);
}
//获取地理位置
- (void) getPosInfo
{
CLLocationManager* locationManager = [[CLLocationManager alloc] init];
if(![locationManager locationServicesEnabled])
{
NSLog(@"请打开定位服务");
return ;
}
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.distanceFilter = kCLDistanceFilterNone;
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
NSLog(@"获取地理位置开始");
CLLocation* currentLocation = [locations lastObject];
CLLocationCoordinate2D coor = currentLocation.coordinate;
mUserPos =[[NSString alloc] initWithFormat:@"latitude=%g&longitude=%g",coor.latitude,coor.longitude];
NSLog(@"userpos:%@",mUserPos);
}
//******************
上述代码得到的运营商信息,网络连接类型,地理位置都是空,要怎么获取?
//获取运营商信息和网络连接类型
-(void)getCarrierInfoAndConnectType
{
CTTelephonyNetworkInfo* info = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier* carrier = [info subscriberCellularProvider];
if (carrier != NULL)
{
mCarrier = [carrier carrierName];
mConnectType = [carrier mobileNetworkCode];
}
NSLog(@"carrier:%@",mCarrier);
NSLog(@"connectype:%@",mConnectType);
}
//获取地理位置
- (void) getPosInfo
{
CLLocationManager* locationManager = [[CLLocationManager alloc] init];
if(![locationManager locationServicesEnabled])
{
NSLog(@"请打开定位服务");
return ;
}
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.distanceFilter = kCLDistanceFilterNone;
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
NSLog(@"获取地理位置开始");
CLLocation* currentLocation = [locations lastObject];
CLLocationCoordinate2D coor = currentLocation.coordinate;
mUserPos =[[NSString alloc] initWithFormat:@"latitude=%g&longitude=%g",coor.latitude,coor.longitude];
NSLog(@"userpos:%@",mUserPos);
}
//******************
上述代码得到的运营商信息,网络连接类型,地理位置都是空,要怎么获取?
0 0
- IOS模拟器能获取运营商信息,网络连接类型以及地理位置吗?
- IOS模拟器能获取运营商信息,网络连接类型以及地理位置吗?
- iOS获取网络类型和运营商信息
- iOS:关于获取网络类型和运营商信息
- iOS:关于获取网络类型和运营商信息
- iOS:关于获取网络类型和运营商信息
- iOS:关于获取网络类型和运营商信息
- iOS 关于获取网络类型和运营商信息
- iOS获取当前设备的型号、分辨率、运营商以及地理位置
- ios获取地理位置信息
- iOS状态栏获取网络类型,运营商,电池电量,显示的系统时间等信息
- iOS 手机网络类型和运营商怎么获取
- ios 简单获取地理位置信息
- 获取Android 运营商网络类型
- iOS获取运营商信息(IMSI)
- iOS利用CoreLocation获取地理位置以及如何在模拟器进行调试
- iOS利用CoreLocation获取地理位置以及如何在模拟器进行调试
- iOS利用CoreLocation获取地理位置以及如何在模拟器进行调试
- NSNotification的实现原理
- Android读取web service的返回值(int)
- Android studio ADM无法打开时什么问题?
- android 中fragment和activity
- AJAX操作01_json与xml
- IOS模拟器能获取运营商信息,网络连接类型以及地理位置吗?
- 黑苹果 开发
- 怎么阅读Android源码
- iOS蓝牙高手请进--GATT需要通过MFI吗?
- Django1.10 mongoengine的复杂嵌套模型
- 完全编译安装boost
- 蓝牙传输文件,如何知道进度和传输完成
- HDU 1312 Red and Black(水题)
- Android中线程同步之Mutex与Condtion的用法