# Installation

WARNING

Minimum supported iOS version is 11.0, supported language is Swift.
The iOS User.com SDK should be installed or updated using CocoaPods, a dependency manager Swift projects. CocoaPods provides added simplicity for integration and updating. We fully support Swift and Objective-C projects.

Step 1. Install CocoaPods

Before beginning this process please ensure that you are using Ruby version 2.0.0 (opens new window) or greater.

To get started simply run the following command in your terminal:

$ sudo gem install cocoapods

More information about installation process can be found in Getting Started Directions on CocoaPods.org (opens new window). If you have any issues regarding CocoaPods additional help can be found in CocoaPods Troubleshooting Guide. (opens new window)

Step 2: Constructing the Podfile

Now that you’ve installed the CocoaPods Ruby Gem, you’re going to need to create a file in your Xcode project directory named Podfile. The contents of the file should look like this:

platform :ios, '11.0'
use_frameworks!

target 'YourApp' do
pod 'UserSDK', :git => 'https://github.com/UserEngage/iOS-SDK'
end

Please remember to replace YourApp with a name of your target in the contents of Podfile.

Step 3: Installing the SDK

To install the User.com SDK, navigate to the directory of your Xcode app project within your terminal and run the following command:

$ pod install

At this point you should be able to open the new Xcode project workspace created by CocoaPods. Remember to open Xcode project workspace instead of Xcode project!

xcode

Step 4. Initialize SDK in your app

  • Swift
  • Objective C
To initialize User.com SDK, you need to add the following line of code to the top of your AppDelegate.swift file:
import UserSDK

Then initialize User.com builder with your SDK API key, context and base URL. It will initialize User.com instance.

You can generate API key in User.com web panel, as described in getting started section.

  • Swift
  • Objective C

Within your AppDelegate.swift file, add the following snippet within your

application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool

method:

let sdk = UserSDK(
application: UIApplication.shared,
apiKey: "<api_key>",
baseURL: "<your_domain>.user.com",
shouldTrackActivities: true)

Be sure to update api_key and your_domain with the correct values from your App Settings page. If you want to track you client’s mobile view screens activities remember to set shouldTrackActivities to true.