我对这项技术很陌生,所以请帮助我。
我正在使用 CLLocationManager 获取当前位置,我的应用程序有自定义设置显示他是否允许当前位置的状态,即我们编写时默认出现的消息提示
[self.locationManager startUpdatingLocation];
如果用户点击不允许该消息提示并返回到我的应用程序自定义设置并更改关闭按钮以打开位置,我可以获取用户的当前位置。
这个东西怎么实现?
最佳答案
一旦用户拒绝了您的应用程序的位置服务,它只能在常规设置中重新打开 - 所以告诉用户然后将它们发送到那里。 (您可能想先使用 UIAlertView 通知他们。)
// If Location Services are disabled, restricted or denied.
if ((![CLLocationManager locationServicesEnabled])
|| ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusRestricted)
|| ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied))
{
// Send the user to the location settings preferences
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"prefs:root=LOCATION_SERVICES"]];
}
关于iphone - CLLocationManager - iPhone 应用程序中的自定义位置管理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10585897/