8

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>
Sridhar
  • 2,228
  • 10
  • 48
  • 79
  • Is 'always' menu not only coming in simulators? – Sridhar Jul 10 '20 at 14:24
  • update the post with code you are using to request for location permission. – Bilal Jul 13 '20 at 09:19
  • @Bilal, I have used whenInUse request. But this is independent right. I am going to app setting and I tried to change the location permission – Sridhar Jul 13 '20 at 13:10
  • 1
    I observed this issue too. If I run app on device with iOS 14 beta 2, always is there – phnmnn Jul 14 '20 at 07:09
  • 1
    I am observing the same behavior as of Xcode 12 Beta 3 and iOS 14.0. Regardless what what permissions I ask for on simulator it never shows "Always" option, on the other hand on device it always shows "Always" option regardless of what permissions I ask for. This is clearly a behaviour that is different on device and simulator. – Tankista Jul 31 '20 at 08:55
  • 1
    I created this feedback and let's see if they reply something https://feedbackassistant.apple.com/feedback/8223899 – Tankista Jul 31 '20 at 09:18

5 Answers5

7

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..."

Shashank Mishra
  • 1,051
  • 7
  • 18
3

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.

Seán Labastille
  • 712
  • 7
  • 17
1

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.

Kayla Galway
  • 662
  • 4
  • 7
  • I have some queries while doing some changes for ios 14. If we implement new method then we have to remove deprecated one ? And if we do this changes that never affect on other iOS version below ios 14. Please help me to understand this. Thanks – Protocol May 08 '21 at 18:47
0

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.

Brian Sachetta
  • 3,319
  • 2
  • 34
  • 45
-1

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.

Bilal
  • 18,478
  • 8
  • 57
  • 72
  • I was not calling requestAlwaysAuthorization(), but I can see 'always' menu in the location permission setting screen in iOS 13 simulator – Sridhar Jul 14 '20 at 10:23
  • As far as I know behaviour is same for IOS 13. You can try the IOS 13 simulator again (Reset the simulator first to make sure all the existing app settings are gone) – Bilal Jul 14 '20 at 11:03
  • @Sridhar if you are seeing Always option in IOS13. You or any other third party SDK must have requested for Always permission. You can do a quick test, just create a new sample app and just request for While In Use permission, run the app and verify the permissions in app settings. – Bilal Jul 15 '20 at 11:36
  • What you described is not true. On simulator it never shows "Always" regardless of what permissions you ask for. On device, it always shows "Always" regardless of what you ask for. This is clearly a buggy behaviour. – Tankista Jul 31 '20 at 08:51