iOS Location Permissions

How to ask the user for Location Always Allow Permissions:

Add Location Usage Description strings to Info.plist

  • Open your app's Info.plist

  • Add a new key named NSLocationAlwaysUsageDescription of Type String (if it does not exist already)

  • Add a new key named NSLocationWhenInUseUsageDescription of Type String (if it does not exist already)

  • Add a new key named NSLocationAlwaysAndWhenInUseUsageDescription of Type String (if it does not exist already)

  • These key values will be the text displayed in location permission authorization prompts for your app. You may may customize them to fit your app.

  • If you are using location permissions to enable a feature in your app you may keep your existing permission dialog language. Otherwise, if you are adding permissions solely for the snippet you may use this description which has worked with Apple review and users: "Grant the Always Allow permission to enable <App> to intermittently detect Bluetooth Low Energy Beacons when you visit certain stores and restaurants. We monetize this anonymous beacon data with third parties to support continued app development."

Location Permission Authorization Code

AreaMetrics requires that the user authorize location when the app is not running. Ensure that your request is done via the requestAlwaysAuthorization method, and is triggered on a screen where the user understands the context and is likely to be receptive.

Starting with iOS 13, the permission prompts are sequenced by the OS and some time can pass before Always Allow permission is fully obtained. You may simply ask for requestAlwaysAuthorization location permission as before, but ensure that the text on each popup is customized as described in the above section. More detailed information can be found from Apple here: https://developer.apple.com/documentation/corelocation/requesting_authorization_for_location_services

You may use the CLLocationManager instance in AreaMetrics.swift to request location permission at the moment you believe is ideal:

AreaMetrics.sharedInstance.locationManager.requestAlwaysAuthorization()

Do not enable the Background Mode of "Location updates" unless you independently require it

In your Project Capabilities under Background Modes there is a checkbox "Location updates", which can also be found in your info.plist as the line "App registers for location updates" under "Required background modes". Do not check this box or include this line unless your app already uses this functionality. The setting is unnecessary for the functioning of the SDK, and including it will impede your App Store approval.

Last updated