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

Replace the three Info.plist entries with appropriate descriptions.

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.

Depending on your desired UX, you may also implement a requestWhileInUseAuthorization request beforehand, and then present a requestAlwaysAuthorization as a way of "upgrading" the permission. This method is detailed in the following link: https://gimbal.com/ios11-location-services-best-practices/

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

Swift
Objective-C
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.