Ios 用户位置在地图中不可见
用户位置在地图中不可见 iOS 9.1Ios 用户位置在地图中不可见,ios,objective-c,core-location,Ios,Objective C,Core Location,用户位置在地图中不可见 iOS 9.1 Xcode 7.1.1模拟器还是设备?您是否在plist中添加了所需的密钥?是的,我在plist NSLOCATION中添加了此密钥当在模拟器中不使用描述测试时,在模拟器中您无法获得用户位置,您只能模拟一个位置!!!从模拟器的菜单中选择调试>位置>自定义位置…谢谢!它在设备中工作 @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do
Xcode 7.1.1模拟器还是设备?您是否在plist中添加了所需的密钥?是的,我在plist NSLOCATION中添加了此密钥当在模拟器中不使用描述测试时,在模拟器中您无法获得用户位置,您只能模拟一个位置!!!从模拟器的菜单中选择调试>位置>自定义位置…谢谢!它在设备中工作
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[[self mapView] setShowsUserLocation:YES];
self.locationManager = [[CLLocationManager alloc] init];
[[self locationManager] setDelegate:self];
if ([[self locationManager] respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[[self locationManager] requestWhenInUseAuthorization];
}
[[self locationManager] setDesiredAccuracy:kCLLocationAccuracyBest];
[[self locationManager] startUpdatingLocation];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end