GeoSpark provides an iOS SDK that enables app developers to track location, geofence and trips.
Thereb are two methods by which GeoSpark iOS SDK can be used. You can install it with CocoaPods or manually (install it by including the SDK source code in your Xcode project).
Add the GeoSpark SDK to your Podfile as shown below.
Once you have updated your Podfile run pod install in your terminal to automatically download and install the SDK in your project.
Download and unzip the GeoSpark SDK.
Add the GeoSpark SDK to your Xcode Project by dragging the file into your Project Navigator.
You can do this by selecting the project file in the navigator on the left side of the Xcode window, and then navigating to the Linked Frameworks and Libraries section. From there, click the + button to add the GeoSpark frameworks.
To track the user's location in the foreground, background , you must add the below string key in your
Privacy - Location Always Usage Description Privacy - Location Always and When In Use Usage Description Privacy - Location When In Use Usage Description Privacy - Motion Usage Description
Then, in project settings, go to Capabilities > Background Modes and turn on background fetch, location updates ,remote-notifications.
Import GeoSpark into your
Initialize the SDK in your
AppDelegate class before calling any other GeoSpark methods under this
GeoSpark using the SDK is capable of sending push notifications to your users . Check here to get device token.
Before tracking the user's location, the user must have authorized location permission and motion permission for the app.
The SDK needs a User ID object to identify the device. Before creating user you should have a device token as creating user without device token is not possible.
If you already have a User ID, then SDK has a convenience method
getUser() to start the session for the existing user.
You can set Description for user by using
You can start tracking the user location by using
User can be logged out by using