Airship supports location updates.

Airship exposes a very simple, high-level API for requesting location updates, through UALocation .


In Airship SDK 13.0, location services are part of an optional standalone framework, called AirshipLocation. In order to access Airship location services, first add a separate import statement in your code, as shown below.


You can ignore the import statement if you use CocoaPods.

import AirshipLocation
@import AirshipLocation;

To access the location instance, simply call the following method.

UALocation *location = [UALocation shared];
let location = UALocation.shared()

Enabling location

Airship’s location framework relies on Apple’s significant-change location service, which lessens battery impact but requires always-on usage. See Getting the User’s Location for details.

Before you can access the user’s location, the user must authorize your application via a location authorization prompt. For the authorization prompt to display properly, you must add the NSLocationAlwaysUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription keys to your application’s info.plist.

Enable location
UALocation.shared().isLocationUpdatesEnabled = true
[UALocation sharedLocation].locationUpdatesEnabled = YES;

When location updates are enabled for the first time it will prompt the user for permission. This behavior can be changed by disabling autoRequestAuthorizationEnabled.

Allow Background Location

Once the app backgrounds, location updates will be suspended by default, then resumed again once the app is foregrounded. To allow location updates to continue in the background, enable backgroundLocationUpdatesAllowed:

Allow background location
UALocation.shared().isBackgroundLocationUpdatesAllowed = true
[UALocation shared].backgroundLocationUpdatesAllowed = YES;