The minimum requirements for the IndoorAtlas iOS SDK are
- Xcode version that supports at least iOS 9.0 SDK.
- iOS 9.0 or later.
- iPhone 4S or later.
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
- If you don’t have an Xcode project yet, create one.
- Create a file called Podfile in your project directory.
- 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.
4. Install the pod and any additional dependencies you might have with the command:
5. Close Xcode and from now on use your project’s .xcworkspace file to open the project:
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', '~> 3.1.0' end
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.
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> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>Platform location requested for better positioning experience.</string> <key>NSBluetoothAlwaysUsageDescription</key> <string>Bluetooth requested for better positioning experience.</string> <key>NSBluetoothPeripheralUsageDescription</key> <string>Bluetooth requested for better positioning experience.</string>
It's possible to omit the bluetooth plist keys by including IADisableBluetooth key. This also disables eddystone beacon scanning support. iBeacon support does not need bluetooth permissions to function.
To access the classes of the framework, include import statements at the top of any relevant source files:
Every application which uses IndoorAtlas’ service needs unique ApiKey and Secret strings, which you can manage with IndoorAtlas Applications.
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];
Same in Swift:
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:
If you suppress the pop up, remember to instruct users to turn on Bluetooth for better positioning performance.
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>location</string> </array>