Setup
Notes
- Make sure you have already created an Application before starting the integration process.
- If your company uses any type of firewall, you will have to allow the Incognia IP. Contact us to receive this information
Minimum requirements
First, check out if you fulfill the SDK minimum requirements.
Requirement | Version |
---|---|
XCode | 12.0 or higher |
Project target | iOS 9 or higher |
For Swift projects | Swift 3.0 or higher |
CocoaPods | 1.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.
source 'https://github.com/CocoaPods/Specs.git'
pod 'Incognia', '~> 6.4.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
Add Incognia's config file to your project
The Incognia SDK initialization relies on the presence of an IncogniaOptions.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.
- Swift
- Objective-C
import Incognia
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
//Initializes the Incognia SDK
ICGIncognia.initSdk()
return true
}
}
#import "AppDelegate.h"
@import Incognia;
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//Initializes the Incognia SDK
[ICGIncognia initSdk];
return YES;
}
@end
If the SDK was initialized properly, your console output will look like the one below.
InLoco: Incognia Common SDK v6.4.3 is running.
InLoco: Incognia Location SDK v6.4.3 is running.
InLoco: Incognia SDK v6.4.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.
Location Permissions
The location permission is essential in order to allow Incognia to provide value to the user. Once allowed, Incognia SDK can start detecting location points. Users that don't accept the location permissions won't generate location data, thus, not being able to receive benefits from Incognia features.
To prepare your app for requesting location, you must add keys with purpose strings to your app's Info.plist file. The system displays your purpose strings in the authorization request dialogs. Configure the keys in Xcode with the following key.
Key | Description |
---|---|
NSLocationWhenInUseUsageDescription | Your app requests When In Use authorization or Always authorization. |
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. Further information about the importance of the location permissions and examples about requesting them can be found here.
What's next?
From here, you can either complete the production 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.