UserIQ 2.6.0

UserIQ 2.6.0

Maintained by Aravind G S.



UserIQ 2.6.0

  • 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.

Cocoapods

Add

  pod 'UserIQ', '~> 2.5'

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

Carthage

Add

  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 https://github.com/useriq-com/ios-sdk.git

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

    Objective-C:

      #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 {
        UserIQSDK.sharedInstance().initWithAPIKey(
          "<YOUR-API-KEY>",
          userId: "EMP124",
          name: "Alex",
          email: "[email protected]",
          accountId: "1",
          accountName: "Acme Corp",
          signupDate: "2017-04-21",
          andParameters: ["location":"Atlanta"]
        )
      }

    Objective-C :

      -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.
        [[UserIQSDK sharedInstance] initWithAPIKey:@"<YOUR-API-KEY>"
                                          userId:@"EMP124"
                                            name:@"Alex"
                                           email:@"[email protected]"
                                       accountId:@"1"
                                     accountName:@"Acme Corp"
                                      signupDate:@"2017-04-21"
                                   andParameters:@{@"location":@"Atlanta"}];
      }

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

Step 4: 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"}

API & USAGE

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