Skip to content

iOS SDK Setup#

Installation#

The Citymapper SDK is provided through Cocoapods and supports iOS 11 and above.

The SDK is made up of two modules and you can decide which one you want to include based on your needs

Add dependencies#

The CitymapperUI artifact contains complete drop-in UI components for displaying directions and turn-by-turn navigation. Our SDK components are available via CocoaPods, so add the following line to your Podfile:

pod 'CitymapperUI'

Alternatively, the CitymapperNavigation artifact includes no UI components, and allows building a custom navigation experience on top of the Citymapper navigation engine. If you don't need our UI, include the following line in your Podfile.

pod 'CitymapperNavigation'

There is no need to include the Navigation component separately if you already include the UI. As an example, if you have an application called MyApp and want to include our UI, then your complete Podfile might look as follows:

target 'MyApp' do
  use_frameworks!
  pod 'CitymapperUI'
end

Once you have created the Podfile, run the following command:

% pod install

Configuration#

Open your project's Info.plist and add the keys CitymapperSDKAPIKey and CitymapperSDKEndpointURL, with their values set to your API Key and API Endpoint URL, respectively.

Background Location Updates#

In order to provide directions whilst users have your app in the background, the SDK requires the background location permission.

Navigate to your project file > Your Target > Signing and Capabilities > + Capability > Background Modes and enable Location updates.

Background Audio#

If you wish to speak our directions (vs simply displaying a local user notification) whilst your app is in the background, you will need to turn on the background audio permission.

Navigate to your project file > Your Target > Signing and Capabilities > + Capability > Background Modes and enable Audio, AirPlay, and Picture in Picture.

Localization#

If you wish to test the SDK with (for example) a French localisation, in addition to adjusting your device's language to French, please ensure that your app also supports the French localisation. This is probably less of an issue with production apps, but may be an issue with prototype apps you use to evaluate the Citymapper SDK.

Greater detail can be found in the second part of this reply on the Apple developer forums.