當用戶在MainViewController
如何檢查是否用戶點擊不上NSLocationAlwaysAndWhenInUseUsageDescription雨燕3.2
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
locationManager.requestAlwaysAuthorization()
locationManager.requestWhenInUseAuthorization()
}
viewDidLoad()
將運行並警告會出現
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Accessing user location to determine the nearest pickup location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Accessing user location to determine the nearest pickup location</string>
的主要問題是,如果用戶點擊不允許,我該如何檢查編程?例如
// Example code snippet, not from apple officials
if NSlocation is nil then I want to do some alert
https://developer.apple.com/documentation/corelocation/cllocationmanagerdelegate/1423701-locationmanager – Paulw11