iOS SDK Setup & Initialize

Installation

VisilabsIOS is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'VisilabsIOS'

Initializing

Import VisilabsIOS in AppDelegate.swift and call createAPI method within application:didFinishLaunchingWithOptions: method.

The code below is a sample initialization of Visilabs library.

import VisilabsIOS func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { Visilabs.createAPI(organizationId: "YOUR_ORGANIZATION_ID", profileId: "YOUR_PROFILE_ID" , dataSource: "YOUR_DATASOURCE", inAppNotificationsEnabled: false, channel: "IOS" , requestTimeoutInSeconds: 30, geofenceEnabled: false, maxGeofenceCount: 20, isIDFAEnabled: true) return true }

Initial Parameters

  • Mandatory Parameters

  • Optional Parameters

    • inAppNotificationsEnabled : Default value is false. If you want to use in app notification feature of Visilabs you need to set the value to true. If you are not using in app notification feature of Visilabs, we recommend that you leave this value to false in terms of performance because in each event request, another request is sent to check whether there exists a notification for the relevant event.

    • channel : Default value is "IOS". If you want to categorize the events of your IOS application under another different channel name in the Analytics section of the admin panel you may change this value.

    • requestTimeoutInSeconds : Default value is 30. The request timeout value in seconds to send data to Visilabs servers and receive data from.

    • geofenceEnabled : Default value is false. If you want to use geofencing feature of Visilabs you need to set the value to true. If you are not using geofencing feature of Visilabs, we recommend that you leave this value to false in terms of performance and user experience because region monitoring would increase the battery consumption of your application and prompt users a popup dialog to allow location tracking.

    • maxGeofenceCount : Default value is 20. Apple prevents any single application from monitoring more than 20 regions simultaneously. Visilabs can use all these slots. However if you need some of these slots for another use you can set this parameter to a value lower than 20. Setting a value higher than 20 would not affect the maximum number of regions to be monitored.

    • isIDFAEnabled: Default value is true. After iOS 14, if you want to use AdvertisingTrackingID you should request a permission from end user. If this parameter is true, then you should add Privacy - Tracking Usage Description into your Info.plist with proper description. As soon as you call createAPI There will open popup to request permission from end user. Click here for detailed information

Debugging

You can turn on logging by setting loggingEnabled property to true. If enabled the

Visilabs.callAPI().loggingEnabled = true

The default protocol for requests to Visilabs servers is https. If you want to debug your requests more easily, you can change your protocol by setting insecureProtocol property to true.

 

Copyright 2020 Related Digital