我已經設置了NSLocationAlwaysUsageDescription
和NSLocationWhenInUseUsageDescription
在info.plist
,當應用程序想要使用位置服務時會顯示警報,但警報只顯示一段時間,而我無法點擊在這個警報。此警報自動消失!在iOS 9中的位置服務許可提醒
func showLocation(sender: UIButton)
{
let manager = CLLocationManager()
manager.delegate = self
if CLLocationManager.authorizationStatus() != CLAuthorizationStatus.AuthorizedAlways
{
manager.requestWhenInUseAuthorization()
}
manager.startUpdatingLocation()
}
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
for location in locations {
print("The location is (location)")
}
}
檢查這一步一步,看看你是否正確使用它。 http://matthewfecher.com/app-developement/getting-gps-location-using-core-location-in-ios-8-vs-ios-7/ – UlyssesR
在你的方法'alertView.dismissWithClickedButtonIndex (0,animated:true)' –
請提供一些代碼 –