iOS SDK setup

Download the SDK with CocoaPods

1. Get CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.

If you don’t already have CocoaPods installed install it by running following commands in the terminal. For details see: CocoaPods getting started.

sudo gem install cocoapods
pod setup

2. Install IndoorAtlas SDK using CocoaPods

  1. If you don’t have an Xcode project yet, create one.
  2. Create a file called Podfile in your project directory.
  3. Edit the Podfile and add your dependencies. Here is a simple example:
use_frameworks!
target 'project-target-name' do
  pod 'IndoorAtlas'
end
  1. Make sure you are using use_frameworks! in your Podfile.
  2. Save the Podfile.
  3. Open a terminal and go to the directory containing Podfile.
cd <path-to-project>
  1. Install the pod and any additional dependencies you might have with the command:
pod install
  1. Close Xcode and from now on use your project’s .xcworkspace file to open the project:
open <your-project>.xcworkspace

Older versions of the SDK

All non-beta releases are available in the CocoaPods trunk repository. If you want to use an older SDK version or an alpha/beta build, they can be used in CocoaPods by defining the IndoorAtlas repository.

Example Podfile for using SDK version 2.5.3:

target 'project-target-name' do
  source 'https://github.com/IndoorAtlas/CocoaPods-Specs.git'
  source 'https://github.com/CocoaPods/Specs.git'
  pod 'IndoorAtlas', '~> 2.5.3'
end

Disabling Bitcode

IndoorAtlas.framework uses processor optimized assembly functions, so it is not possible to enable Bitcode. Go to Build Settings in your project and under Build Options set Enable Bitcode to No.

Develop

Add the following plist keys to your application plist to enable the use of motion sensors and location services:

<key>NSMotionUsageDescription</key>
<string>For better indoor positioning.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Platform location requested for better positioning experience.</string>

To access the classes of the framework, include import statements at the top of any relevant source files:

@import IndoorAtlas;

import IndoorAtlas

Authorization

Every application which uses IndoorAtlas’ service needs unique ApiKey and Secret strings, which you can manage with IndoorAtlas Applications. Further information on API keys can be found here.

Use the IALocationManager ’s setApiKey:andSecret method to set credentials.

static NSString *kAPIKey = @"api-key-here";
static NSString *kAPISecret = @"api-secret-here";
// ...

// Set IndoorAtlas ApiKey and Secret
[locationManager setApiKey:kAPIKey andSecret:kAPISecret];

let kAPIKey = "api-key-here"
let kAPISecret = "api-secret-here"
// ...

// Set IndoorAtlas ApiKey and Secret
locationManager.setApiKey(kAPIKey, andSecret: kAPISecret)

Enabling beacon support

SDK 2.3 and later supports beacons as part of the positioning. Beacons can shorten time to first fix and add robustness in areas that have challenging radio environment. Beacons are not required for the positioning to work, but enabling this feature is recommended for optimal performance. Note that the venue needs to be mapped with MapCreator 2.

Enabling listening to iBeacons and Eddystone beacons is done as a part of requesting CoreLocation usage rights. Therefore no additional usage rights are needed for enabling beacon support.

If bluetooth is turned off, an alert “Turn On Bluetooth to Allow to Connect to accessories.” will be shown. It is possible to suppress this alert by setting the following app plist key:

<key>IANoCoreBluetoothPowerAlert</key>
<string>AnyString</string>

If you suppress the pop up, remember to instruct users to turn on Bluetooth for better positioning performance.

Enabling background-mode

iOS limits running applications in the background. To obtain position updates in the background, the app needs to have suitable usage rights. The iOS SDK examples have an example of background use. The required plist keys for accessing the platform locations and beacon observations are:

<key>NSLocationAlwaysUsageDescription</key>
<string>Platform location requested for better indoor positioning experience.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Platform location requested for better indoor positioning experience.</string>
<key>UIBackgroundModes</key>
<array>
	<string>bluetooth-central</string>
	<string>location</string>
</array>