iOS 14: Allow Location Access | Always menu not found

Viewed 6459

I tried to run my project in Xcode 12 beta 2 with iOS 14 simulator. I observed "Always" menu is not found in Allow Location Access Setting screen.

enter image description here

I have given the followings info.plist

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>TEST APP</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>TEST APP</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>TEST APP</string>
5 Answers

The "Always Allow" option has been removed from the initial location permissions prompt. You can get this option later as a new prompt. Then the question comes, how will we support the location feature if we need it in the background?

enter image description here

Way to achieve this -

  1. Call the method "locationManager.requestAlwaysAuthorization()" before your app can receive location information. If your app needs always permission and you want to receive the prompt for always permission later.

  2. Initially, users can select "While Using the app" or select a new option, "Allow Once"(introduced in iOS 13 itself).

  3. If the user continues to use the app, iOS 13 will now automatically prompt to upgrade location permissions from "While Using the app" to "Always Allow".

    enter image description here

  4. You will receive #2 prompt next time after unlocking the device and launching the app with already grated "While Using the app" permission.

Source

This WWDC 2019 video also suggests that this is still possible: https://developer.apple.com/videos/play/wwdc2019/705/

At 6:57 "...you can request when in use authorization first, then, at some later point, when the user interacts with a feature of the app that warrants it, seek always authorization later..."

I have also observed this issue and filed feedback about it — no response so far apart from there being "less than 10" other reports about it.

There seems to be a workaround using the simctl command line tool:

xcrun simctl privacy booted grant location-always <bundle identifier>

This enables the "Always" option in Settings.

It looks like there are a few updates in location management for iOS 14.

One of them is that locationManager(_:didChangeAuthorization:) is now deprecated, so you need to implement locationManagerDidChangeAuthorization(_:) in your CLLocationManager instead.

You also need to make sure you are calling the requestAlwaysAuthorization() function on your Location Manager. From apple docs about this function:

You must call this or the requestWhenInUseAuthorization() method before your app can receive location information.

I was running into the same issue. From what I can tell, this is/was a bug with the first several Beta versions of Xcode 12. I upgraded to Beta #6 when it came out this morning, and the issue has now gone away for me. See if that fixes it for you as well.

Whatever you request in your app same options appear in settings of your app.

If you have requested for when in use authorization only using requestWhenInUseAuthorization() method of CLLocationManager only While Using the App will appear in your app settings.

If you request for always using requestAlwaysAuthorization() Always option will appear in your app settings.

You can request for both requestAlwaysAuthorization() and requestWhenInUseAuthorization() at some point in your app depending on your use case.

Related