【发布时间】:2015-07-24 10:47:34
【问题描述】:
您好,我正在对我的应用程序使用 CLLocation,并且我已经像这样初始化了我的 CLLocationManager:
func initLocationManager(){
locationManager = CLLocationManager()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
let authstate = CLLocationManager.authorizationStatus()
if(authstate == CLAuthorizationStatus.NotDetermined || authstate == CLAuthorizationStatus.Denied){
println("Not Authorised")
locationManager.requestWhenInUseAuthorization()
}
locationManager.startUpdatingLocation()
}
我还在我的 plist 中添加了 NSLocationAlwaysUsageDescription 和 NSLocationWhenInUseUsageDescription 键。
当我第一次打开我的应用程序时,我会收到我的应用程序想要访问位置的提示消息,它有 2 个按钮允许和不允许。如果我单击不允许按钮并关闭应用程序,当我再次打开它时,我不会再次收到提示消息。
如何在每次用户打开应用程序时显示此提示消息?谢谢
【问题讨论】:
-
据我所知这是不可能的。此系统提示仅在第一次显示。然后就不会再出现了。您可以显示自定义警报,告诉用户转到设置并为您的应用启用位置服务。
标签: ios swift cllocationmanager