You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to detect network changes in background.
But there was a problem when requesting location permission.
CLLocationManager.authorizationStatus() returns .authorisedAlways when the device is set to “While Using the App”
Maybe because I don't know iOS and Swift well. What's wrong?
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 13.0, *) {
let status = CLLocationManager.authorizationStatus()
if status == .authorizedAlways {
print("Always")
startWifiDetection()
} else if status == .authorizedWhenInUse {
print("While Using the App")
locationManager.delegate = self
locationManager.requestAlwaysAuthorization()
} else {
print("Never or Ask Next Time")
locationManager.delegate = self
locationManager.requestWhenInUseAuthorization()
}
}
}
The text was updated successfully, but these errors were encountered:
I need to detect network changes in background.
But there was a problem when requesting location permission.
CLLocationManager.authorizationStatus() returns .authorisedAlways when the device is set to “While Using the App”
Maybe because I don't know iOS and Swift well. What's wrong?
The text was updated successfully, but these errors were encountered: