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
use_frameworks! target 'project-target-name' do pod 'IndoorAtlas' end
use_frameworks!in your Podfile.
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
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>
To access the classes of the framework, include import statements at the top of any relevant source files:
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)
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>bluetooth-central</string> <string>location</string> </array>