HyperTrack iOS SDK Setup
To use the HyperTrack SDK on iOS you we first need to setup the SDK into our environment.
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
[info] Minimum Deployment target
HyperTrack SDK support iOS 8.0 and above as deployment targets.
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("YOUR_PUBLISHABLE_KEY")
@import HyperTrack; [HyperTrack initialize:@"YOUR_PUBLISHABLE_KEY"];
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 & Motion usage permissions
The SDK is only compatible with the Location - Always and Motion Usage permissions. You can use the included utility methods to request permission, in case you feel the need to.
[HyperTrack requestAlwaysAuthorization]; [HyperTrack requestMotionAuthorization];
Now that we have the SDK setup in our environment we can move into basic integrations.