The difference between iOS location permissions

This article github address: github.com/stelalae/bl…

Nowadays, more and more attention is paid to privacy protection, and it is difficult to obtain geographical location +++, and it is easy to be rejected in APP Store audit due to incorrect location permission configuration. Currently, iOS info.plist has 4 location permission Settings and corresponding versions:

  • Privacy-location Usage Description: iOS 6.0-8.0
  • Privacy-location When In Use Usage Description: iOS 11.0+
  • Privacy-location Always Usage Description: iOS 8.0-10.0
  • Privacy-location Always and When In Use Usage Description: iOS 11.0+

The following tests were performed on iOS 12.3.1 and 13.1.2 respectively, referred to as iOS12 and iOS13 respectively.

Detailed instructions

1. Privacy – Location Usage Description

The official website states that it is applicable to iOS 6.0-8.0, so it is no longer used in new projects. It doesn’t matter whether you write or not.

2. Privacy – Location When In Use Usage Description

You can only use the APP to obtain the location during the application period, as explained on the official website, for iOS 11.0+.

In the iOS 12

  • User Prompt box
  • The Settings menu

In the iOS 13

  • User Prompt box
  • The Settings menu

3. Privacy-location Always Usage Description and privacy-location Always and When In Use Usage Description

Privacy-location Always Usage Description and privacy-location Always and When In Use Usage Description, Both applications allow the APP to obtain the location of both the front and the back. Here are the specific differences.

First look at the official website:

  • NSLocationAlwaysUsageDescription, iOS 8.0-10.0, has been abandoned, is compatible with the need to configure the iOS 11 before.

Use this key if your iOS app accesses location information in the background, and you deploy to a target earlier than iOS 11. In that case, The add to both this key and NSLocationAlwaysAndWhenInUseUsageDescription to app ‘s Info. Plist file with the same message. Apps running on older versions of the OS use the message associated with NSLocationAlwaysUsageDescription, while apps running on later versions use the one associated with NSLocationAlwaysAndWhenInUseUsageDescription. If your app only needs location information when in the foreground, use NSLocationWhenInUseUsageDescription instead. For more information, see Choosing the Location Services Authorization to Request. If you need location information in a macOS app, use NSLocationUsageDescription instead.

  • NSLocationAlwaysAndWhenInUseUsageDescriptionIOS 11.0+ is designed to replace iOS 11 and laterNSLocationAlwaysUsageDescription.

Use this key if your iOS app accesses location information while running in the background. If your app only needs location information when in the foreground, use NSLocationWhenInUseUsageDescription instead. For more information, see Choosing the Location Services Authorization to Request. If you need location information in a macOS app, use NSLocationUsageDescription instead. If your iOS app deploys to versions earlier than iOS 11, see NSLocationAlwaysUsageDescription.

In the iOS 13

  • The Settings menu

conclusion

  • If the app needs to front desk operation location permissions, need to configure the NSLocationWhenInUseUsageDescription;
  • If the app need background location permissions, need to configure the NSLocationAlwaysAndWhenInUseUsageDescription; (if the adapter iOS version before 11, also need to configure NSLocationAlwaysUsageDescription)

Choosing the Location Services Authorization to Request

In May 2020, a new package was put on the shelves. Before that, I added all the location permissions according to other people’s documents, so I received the rejected gift package:


References:

  • What are the differences between the various types of location permissions in iOS
  • [Resource Sharing] Common errors in locating permission requests in iOS