Skip to main content
Version: v5

Setup

Minimum requirements#

First, check out if you fulfill the SDK minimum requirements.

RequirementVersion
XCode9.0 or higher
Project targetiOS 9 or higher
For Swift projectsSwift 3.0 or higher
CocoaPods1.2.0 or higher

Dependencies#

Your application must use CocoaPods in order to install the Incognia SDK. CocoaPods manages library dependencies for your Xcode projects; to learn more, check its installation guide.

Create a Podfile if you don't have one by typing the following command:

$ pod init

Then, add the Incognia SDK pod to your project's Podfile.

Podfile
source 'https://github.com/CocoaPods/Specs.git'platform :ios, '9.0'
pod 'InLocoEngage-iOS-SDK', '5.8.3'

Install the pod and open the .xcworkspace file to see the project in Xcode.

$ pod install --repo-update$ open your-project.xcworkspace

Capabilities#

The Incognia SDK uses the Access WiFi Information capability to improve visit detection and location accuracy. To allow it, in the Capabilities section of your app, enable the Access WiFi Information capability (XCode 10 and iOS 12+ only):

Note
From iOS 12, Apple added a new capability called Access Wifi Information. Adding this capability is highly recommended as it allows Incognia to use the current connected WiFi to improve visit detection and location accuracy.

Add Incognia's config file to your project#

The Incognia SDK initialization relies on the presence of an InLocoOptions.plist file in your project. To access the configuration file, go to My Apps section on Incognia dashboard and download the file.

The config properties semantics are explained here.

Initializing the SDK#

In the application:didFinishLaunchingWithOptions: method of your AppDelegate file, insert the code below to initialize the Incognia SDK.

import InLocoSDK
@UIApplicationMainclass AppDelegate: UIResponder, UIApplicationDelegate {
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    //Initializes the Incognia SDK    ILMInLoco.initSdk()
    return true  }}

If the SDK was initialized properly, your console output will look like the one below.

InLoco: In Loco Common SDK v5.8.3 is running.InLoco: In Loco Location SDK v5.8.3 is running.InLoco: In Loco Engage SDK v5.8.3 is running.InLoco: The installation identifier is <INSTALLATION-ID>.

Testing#

After integrating the SDK, the wizard will wait for an event to be sent in order to validate that the integration was successful.

Request runtime permissions#

The steps above will initialize the SDK, but your application still needs to request the location permissions to the user in order to fully unlock the location capabilities of the SDK. We recommend that the permissions are requested as shown in the iOS documentation.

Attention
The Incognia SDK makes use of Apple's Visits Location Service, which requires the Always authorization. Not being able to acquire this authorization may greatly reduce the frequency of location-based features. More about the Visits Location Service can be foundhere. It is extremely important that the user is asked for location permissions and that the app has a relevant reason to do so.

What's next?#

From here, you can either complete the full integration with our APIs by using the Installation ID or follow the steps to test the Incognia solution with the SDK-only integration. In this mode, you will receive access to a dashboard that displays Incognia's risk scores without needing to integrate the APIs.