Support for iOS 11 placement permissions when disabled "when using" on iOS 10

When using iOS 10, I need users to choose between not allowing location and always allowing locations, so I added the key NSLocationAlwaysUsageDescriptionto Info.plist.

Now, with the new version of iOS 11, I need to add the following two keys to get an invitation to resolve the location - NSLocationAlwaysAndWhenInUseUsageDescriptionand NSLocationWhenInUseUsageDescription.

When I try to remove the seemingly superfluous NSLocationWhenInUseUsageDescription, it does not allow to display the location hint on iOS 11

Now the problem is that my users on iOS 10 have “when they are used” options in their settings that I don’t need.

Is there a way to create a version that allows “never” and “always” for iOS 10 and allow all three options on iOS 11?

+4
source share
1 answer

In the Info.plist application file, you need to include the NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUsageDescription keys. (If your application supports iOS 10 and earlier, NSLocationAlwaysUsageDescription is also required.) If these keys are missing, authorization requests immediately end.

https://developer.apple.com/documentation/corelocation/choosing_the_authorization_level_for_location_services/request_always_authorization#see-also

+2
source

Source: https://habr.com/ru/post/1684565/


All Articles