HyperTrack iOS SDK Setup
To use the HyperTrack SDK on iOS you we first need to setup the SDK into our environment.
[info] Step-By-Step Onboarding
Setting up HyperTrack iOS SDK in your app?
We recommend you try our new interactive step-by-step onboarding
Step 1: Install the SDK
The HyperTrack SDK is available via CocoaPods. Add the following lines to your Podfile to install the SDK.
In case you haven't setup CocoaPods for your app, refer to their website and setup a Podfile, and then add these lines.
[warning] Xcode project
Remember to use the
.xcworkspacefile to open your project in Xcode, instead of the
.xcodeprojfile, from here on.
use_frameworks! target 'AppName' do pod 'HyperTrack' end
Step 2: Configure the SDK
Now that the SDK has been installed, you can use the SDK methods inside Xcode. Configure your publishable key and initialise the SDK.
[warning] Objective C config
In case your app is in Objective C, edit the Build Settings of the Pods Project. Change the Use Legacy Swift Language Version flag from Unspecified to No for “Alamofire”, “CocoaMQTT” and “HyperTrack” libraries.
import HyperTrack HyperTrack.initialize("pk_publishableKey")
@import HyperTrack; [HyperTrack initialize:@"pk_publishableKey"];
Step 3: Add background capability to your app
Go to the capabilities tab in your app settings, scroll to background modes and switch it on. Select "Location updates", "Background fetch" and "Remote notifications".
Step 4: Add permission strings to your Info.plist
Go to the Info tab in your app settings and add permission strings for "Privacy - Location Always Usage Description" and "Privacy - Motion Usage Description"
Step 5: Configure location permissions
The SDK is only compatible with the Location - Always permission. You can use the included utility methods to request permission, in case you feel the need to.
Now that we have the SDK setup in our environment we can move into basic integrations.