Overview
This article covers the integration of GeoSpark iOS SDK. GeoSpark iOS SDK enables you to track your user location in both online and offline states. The SDK enables you to track location in foreground, background and terminated app state. Our SDK tracks location with minimal battery drain with optimal location hits.
Here are the steps involved in integrating GeoSpark's iOS SDK with your app:
Install SDK
Open Xcode , click on create a new Xcode project -> Select the Single View App.

Open terminal, go to project folder and run pod init
.
Open podfile, add pod GeoSpark
and run pod install
in your terminal.

Once pod installed, import GeoSpark
into your AppDelegate
file.
Configure project
To configure the location services, add following entries to the Info.plist
file.

Then, in your project settings, go to Capabilities > Background Modes
and turn on background fetch, location updates and remote-notifications.

Set DeviceToken
Register for remote notification and get the device token from the following method didRegisterForRemoteNotificationsWithDeviceToken
.
Initialize SDK
Sign up here to create an account with GeoSpark. Post signup, you can create your first project from the dashboard screen.

Once you have created your project, you can add applications with required details.

You can get the publishable key from your project settings page which has to be used while integrating the SDK with your application.

Initialize SDK in didFinishLaunchingWithOptions
method of your Application class.
GeoSpark.intialize("PUBLISHABLEKEY")
Create User
The SDK needs a UserID object to identify the device. The SDK has a convenience method, createUser
to create a user which returns User ID.
GeoSpark.createUser("Enter Description", { (user) in
//user.userId
}) { (error) in
}
Start Location Tracking
To enable motion and location, call requestMotion and requestLocation methods. Calling this method will show alert asking for location permission and motion permission.
GeoSpark.startTracking()
StartTracking the user location and start viewing your user's location data on the dashboard.

Your Application is successfully integrated with GeoSpark iOS SDK.