在执行 CLLocationManager 时,是否有一个委托(delegate)方法在用户单击“允许”或“不允许”提示请求使用 Location 时调用?
我试过了,但是在用户“允许”或“不允许”后不会调用它。
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status;
此外,是否有一个变量可以告诉我用户选择了什么?
我尝试了下面的方法,但总是返回 true。
locationManager.locationServicesEnabled
谢谢你,
三通
最佳答案
有一个委托(delegate)方法
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized) {
// user allowed
}
}
关于objective-c - Objective-C - CLLocationManager 找出何时单击 "Allow"或 "Don' t 允许",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7579636/