UserIQ 2.7.1

UserIQ 2.7.1

Maintained by UserIQ, Aravind G S, Sudhakar, Shri Arun.

UserIQ 2.7.1

  • By
  • Aravind G S

UserIQ iOS SDK Integration Document

CocoaPods Compatible Carthage Compatible Platform

This guide will provide you with step by step details on how to integrate the SDK in just a few minutes. The following steps outline the integration process in details.

Steps to integrate the sdk to your Xcode - iOS project

If you are using Cocoapods or Carthage, skip Step 1 & Step 2, go directly to Step 3.



  pod 'UserIQ', '~> 2.7'

to your Podfile. In terminal, go to the folder of your project and enter pod install. Open <your-project-name.xcworkspace>



  github "useriq-com/ios-sdk"

to your Cartfile. In terminal, go to the folder of your project and enter carthage update

Step 1 : Download the UserIQ framework

Download the UserIQ sdk from here

Alternatively you can clone the UserIQ github repo

  git clone

The UserIQ.framework is to be copied into your project folder.

Step 2 : Attach UserIQ framework to your iOS project

  • Click on the project folder on the project navigator panel.
  • Click on the application under Targets and go to the General tab as shown in image below
  • Click on + button under Embedded Binaries as shown in image below.
  • Click on Add Other from the dialog that appears.
  • Select UserIQ.framework from the project folder.
  • If prompted with a dialog that asks whether to copy the framework, click on Yes.

Step 3 : Initiate the UserIQ framework

  • In your AppDelegate file, import the UserIQ framework

    Swift :

      import UserIQ


      #import <UserIQ/UserIQ.h>
  • In the didFinishLaunchingWithOptions: method initiate the UserIQ sdk using the initMethod as shown below

    Swift :

      func application(_application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    Objective-C :

      -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.
        [[UserIQSDK sharedInstance] initWithAPIKey:@"<YOUR-API-KEY>"];

    Note - The API-KEY can be obtained from the integration page of your app in the UserIQ dashboard.

    This API will initialise the SDK with an anonymous user.

Step 4 : Set the user after login

  • Once user has logged in, the anonymous user can be changed to the current user using the setUser API as shown below. Import the UserIQ SDK in the file (similar to in the previous step) where you receive the user info.

    Swift :

                                        name: "Alex",
                                        email: "[email protected]",
                                        accountId: "1",
                                        accountName: "Acme Corp",
                                        signupDate: "2017-11-29",
                                        andParameters: ["location":"Atlanta"])


      [[UserIQSDK sharedInstance] setUserId:@"EMP124"
                                      email:@"[email protected]"
                                accountName:@"Acme Corp"

    Note - Make sure this api is called on every launch of the app if the app keep users logged in until user manually logs out.

Step 5 : Add the custom parameters (optional)

  • Add any custom attributes about the user in andParameters(String key, String value)

    Swift :

       andParameters: ["location":"Atlanta", "Foo":"Bar", "Foo1": "Bar1"]

    Objective-C :

       andParameters:@{@"location":@"Atlanta", @"Foo":@"Bar", @"Foo1":@"Bar1"}

Step 6 : Logout

  • If a user logs out, the user can be reset to anonymous user just by calling the logout API. Make sure this method is called when the user logs out, so that login screen tracking and other information not related to the user does not get linked to the user.

    Swift :


    Objective-C :

      [[UserIQSDK sharedInstance] logout];


For more details on API & their usage, please refer to wiki page