Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues with "Allow always" location in iOS 13

I've an app which depends on the user's location. Until iOS 13 the app worked correctly but now it doesn' send the user's location.

I've tried to choose the option "While using app" and wait to the next prompt in order to choose "Allow always" but it doesn't work. Choosing "While using app" and going to settings for changing the option to "Allow always" doesn't work. (Both cases are the "official" answer of Apple in the documentation)

Any idea? Thanks

like image 468
Juanjo Avatar asked Sep 26 '19 10:09

Juanjo


People also ask

How do I always allow location in IOS?

Here's how: Go to Settings > Privacy, then select Location Services. Select an app, then turn Precise Location on or off.

Is allow Once Always allow?

With the introduction of Allow Once , the user must grant When In Use before you can prompt for Always . If you request Always before the user has granted When In Use , the user will only have the opportunity to grant When In Use or Allow Once .

What does always allow location mean?

Select an option: All the time: The app can use your location at any time. Only while using the app: The app can use your location only when you're using that app. Ask every time: Every time you open the app, it'll ask to use your location.

What happened to “always on” in iOS 13?

In iOS 13, Apple modified the way third-party apps access location. Now, when you launch the app for the first time, you see three options in the location popup – Allow While Using App, Allow Once, and Don’t Allow. Did you observe that the possibility for Always is gone now?

How to handle “don’t allow” and “allow once” in iOS settings?

If user selects “Don’t Allow”, in the app and in the iOS Setting, we get .denied permission. This is a straightforward case to handle. If user selects “Allow Once”, in the app we received .authorizedWhenInUse permission, and “Ask next time” in the iOS Setting.

What are the location permissions in iOS 13?

iOS 13 has the following three location permissions (ignore Denied since it ignores the permission): Here’s the flow of how the new permission model works under the hood: Allow Once is similar to Allow While Using, but only for one foreground session.

What is “always viewing location” in iOS 13?

Older version of iOS let you grant an app the ability to “Always” view your location and forget about it. iOS 13 won’t let you forget. It’ll regularly show you popups with the message “ [App] has used your location [number of] times in the background over the past [number of] days. Do you want to continue to allow background location use?”


3 Answers

From iOS 13 onwards, Apple replace "Always allow" to "Always once" from permission screen and moved "Always allow" in the settings.

If user select "Always once" then app will prompt location permission screen every time user launch the app.

If user select "While in use" then app will not prompt permission screen next time explicitly user need to travel to settings and give the permission.

Also receiving location update from switching to "While using app" to "Always Allow" from settings works for me.

Here is the properties I specifies

let locationManager = CLLocationManager()
locationManager.requestAlwaysAuthorization()
locationManager.allowsBackgroundLocationUpdates = true
locationManager.pausesLocationUpdatesAutomatically = false
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.delegate = self

.
.
.

extension AppDelegate: CLLocationManagerDelegate {

    func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
        switch status {
        case .authorizedAlways, .authorizedWhenInUse:
            locationManager.startUpdatingLocation()

        case .denied:
            print("Location permission denied")

        case .restricted:
            print("Location permission restricted")

        case .notDetermined:
            print("Location permission notDetermined")

        @unknown default:
            fatalError()
        }
    }

    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        print("Location Update = \(String(describing: locations.first))")
    }

    func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
        print("Location Error = \(error.localizedDescription)")
    }
}

like image 166
iSalman Avatar answered Oct 17 '22 03:10

iSalman


This is a feature introduced in iOS 13 itself. As explained here: https://engineering.q42.nl/apple-location-permission-ios13/ If the user grants you ‘when in use’ permission and you try to scan for location in the background, only then the user will be presented a dialog to grant the background permission.

This is an image for reference

Seems quite buggy as of now, and is definitely not a good UX experience, but that is how it is as of now!

like image 40
Apoorva Verma Avatar answered Oct 17 '22 04:10

Apoorva Verma


This is very annoying from a MDM-perspective, since a location-app that must be used now constantly asks the user if it should still be allowed to use "Always allow". The admins need this to be on "Always allow" so we can track the iPads in case they get lost/stolen.

like image 34
Tommy Borgelin Avatar answered Oct 17 '22 02:10

Tommy Borgelin