位置管理器的委托方法未被调用
Location Manager's delegate method not getting called
没有调用位置管理器 didUpdateLocations。
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
[self.locationManager startUpdatingLocation];
为了回调我正在使用这个委托方法
- (void)locationManager:(CLLocationManager )manager didUpdateLocations:(NSArray )locations
{
NSLog(@"%@", [locations lastObject]);
}
导入框架CoreLocation
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])
{
[self.locationManager requestWhenInUseAuthorization];
}
[self.locationManager startUpdatingLocation];
在 iOS8 及更高版本中,您必须通过调用 requestAlwaysAuthorization 或 requestWhenInUseAuthorization 来请求明确使用位置服务的权限。
没有调用位置管理器 didUpdateLocations。
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
[self.locationManager startUpdatingLocation];
为了回调我正在使用这个委托方法
- (void)locationManager:(CLLocationManager )manager didUpdateLocations:(NSArray )locations
{
NSLog(@"%@", [locations lastObject]);
}
导入框架CoreLocation
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])
{
[self.locationManager requestWhenInUseAuthorization];
}
[self.locationManager startUpdatingLocation];
在 iOS8 及更高版本中,您必须通过调用 requestAlwaysAuthorization 或 requestWhenInUseAuthorization 来请求明确使用位置服务的权限。