Developer's Guide to Installing the Pendo iOS SDK (Objective-C)

Last Updated:

Important: This article includes code examples that do not include the api key and scheme IDs required to successfully install the SDK. A Pendo admin in your subscription can access these unique IDs in App Details under Subscription Settings or in Install Settings in App Details.

For Swift click here

Overview

Pendo captures product usage data, gathers user feedback, and lets you communicate in-app to onboard, educate, and guide users to value. Pendo tagging and guides are codeless, no engineering resources are required. However, we need engineers to install the SDK and initialize Pendo in your app. Information about Pendo and the general installation process is available in the Installation Planning article. With preparation, the technical installation of the Pendo SDK is straightforward.

The SDK is the only technical piece of the initial Pendo installation. Once the SDK is properly installed anyone can use Pendo. The SDK tracks a visitor’s activity in your app, loads guides, and captures session metadata. Additional development may be done later to optimize and expand the use of Pendo for mobile, like track events. The SDK in your mobile app also needs to be updated when we release new versions to use the latest Pendo features.

Pendo has integrations with other popular CRM, analytics, and collaboration tools. The scope of integrations ranges from native integrations with a codeless installation wizard to custom development and will not be covered in this article. Check our Integrations articles for help with our popular integrations or reach out to a Pendo representative for help with integrations in your subscription after completing the SDK installation.

 

Requirements

  • Mobile SDK 2.10 or greater
  • iOS 9.0 or greater

Install Pendo iOS SDK

The SDK can be installed with CocoaPods, Swift Package Manager, or manually. You only need to install once using your preferred method. When this is complete, you need to setup and initialize Pendo to identify the user, collect data, and load guides.

 

Install with CocoaPods

1. Open your PodFile.

Add the following statements at the top of the PodFile.

platform:ios, '9.0'
use_frameworks!
>pod 'Pendo', '~> 2.14.0'

 

2. In the Application folder, run pod install.

 

Swift Package Manager (SPM)

1. In Xcode, open File > Swift Packages > Add Package Dependency   >
2. Search https://github.com/pendo-io/pendo-mobile-ios for package.swift.

 

Manual Installation

1. Download the latest version 2 SDK pendo-ios-sdk-framework file from the pendo-ios-sdk library.

2. Unzip to extract the framework Pendo.framework.

3. Copy Pendo.framework to your project's Frameworks directory by dragging the framework to your project. When prompted, check the option to "Copy items if needed".

4. Under Build Phases > Link Binaries With Libraries, verify that Pendo.framework is listed.

5. Under General > Embedded Binaries, press the + button and add Pendo.framework.

6. Under General > Deployment Target, verify that the deployment target is set for 9.0 or later.

 

Pendo Setup and Initialization

The SDK initialization has two parts, importing the SDK and initializing the SDK when the visitor is identified. The Pendo SDK is imported during application onCreate. The initialization call can occur in any activity where you want to identify the current visitor and the start a session.

Pendo must be initialized to identify the user, begin data collection, and display guide content. The SDK can be initialized when the visitor is authenticated and metadata is known or with an anonymous visitor. Initialization can occur when the application starts, later when the visitor is identified, or any time you need to identify the current visitor and start a new session.

Identified visitors use a defined schema to create visitor and account objects with associated metadata in Pendo. Refer to the article on Visitor and Account Metadata for additional information on how this data is defined and used in Pendo. Passing null or "" as the visitorId will generate an anonymous visitor ID.

  • visitorId - String containing a unique User ID (e.g. "user-SFGH-56gh"), this ID should match the visitor ID for any other Pendo web or mobile apps
  • accountId - String containing unique Account ID, affiliation of the visitor to a specific company or group (e.g. Acme Inc), this ID should match the visitor ID for any other Pendo web or mobile apps
  • visitorData - Visitor metadata (e.g email, phone, country, etc.) 
  • accountData - Account metadata (e.g tier, level, ARR, etc)

 

1. Setup Pendo in AppDelegate class

Add the following code in the application AppDelegate class.

@import Pendo;

 

Add the following code in application(\_:didFinishLaunchingWithOptions:).

setup is settings up the SDK and initializing it.

NSString * appKey = @"<REPLACE_THIS_WITH_YOUR_API_KEY>";

[[PendoManager sharedManager] setup:appKey];     

 

2. Initialize Pendo in the viewController where your visitor is identified

StartSession starts a new session, begins data collection, and loads guides with the provided metadata. This can identify an authenticated user or generate a random visitor ID for an anonymous visitor. Calling startSession again ends the current session and starts a new session, begins data collection, and loads guides using the new visitor metadata that is passed through.

Add the following code to initialize Pendo and identify the current visitor.

[[PendoManager sharedManager] startSession: visitorId
                              accountId:    accountId
                              visitorData:  visitorData
                              accountData:  accountData];

Note: startSession can be used at any time to update the current visitor, must be called after SDK is initialized.

 

Setup Device Connection

To allow tagging your application with Pendo and testing guides, Add the Pendo URL scheme,  and configure the app to handle the URL scheme to complete this configuration.

 

Add Pendo URL Scheme toinfo.plistfile

1. Under App Target > Info > URL Types, create a new URL by clicking the + button.

2. Set Identifier to "pendo-pairing" or any name of your choosing.

3. Set URL Schemes to your scheme ID.

  • Your scheme ID and app key are in App Details in Subscription Settings

 

Configure App to handle Pendo URL Scheme

1. Add the following code in the application AppDelegate file.

@import Pendo;

 

2. Add or modify application:openURL:options:

- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id>
*)options
{
    if ([[url scheme] containsString:@"pendo"]) {
        [[PendoManager sharedManager] initWithUrl:url];
        return YES;
    }
    //  your code here …
    return YES;
}

 

2. If you're using iOS 13+, add the following code in the SceneDelegate file.

@import Pendo;

 

3. If you're using Scenes, add or modifyscene(_:openURLContexts:)

- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {
    NSURL * url = URLContexts.allObjects[0].URL;
    if ([[url scheme] containsString:@"pendo"]) {
        [[PendoManager sharedManager] initWithUrl:url];
    }
}

 

Verify Installation

1. Using Xcode, run the app and search in the device log for

Pendo Mobile SDK was successfully integrated and connected to the server.


2. Confirm that you can see your app under subscription settings marked as Integrated.iOSintegrated.png

 

Additional Configuration

Pendo iOS API Documentation contains additional technical information for configuring the Pendo SDK in your application.

 

Troubleshooting

Review the latest Pendo Mobile SDK release notes for any compatibility issues.

Build Issue: When building an App using Cocoapods you receive a link error: …Framework not found AFNetworking for architecture x86_64 (null): Linker command failed with exit code 1 (use -v to see invocation)

Some libraries installed via Cocoapods do not permit the usage of frameworks. Either use a new version of the 3rd party library or switch to manual installation of the Pendo SDK as described above.

 

Upload Issue: Error messages when uploading to the app store with older Xcode versions

Examples

ERROR ITMS-90087: "Unsupported Architectures. 
The executable for XXX.app/Frameworks/PendoFramework.framework 
contains unsupported architectures '[x86_64, i386]'."
ERROR ITMS-90209: “Invalid Segment Alignment. 
The app binary at ‘XXX.app/Frameworks/InsertFramework.framework/PendoFramework’ 
does not have proper segment alignment. Try rebuilding the app with the latest 
Xcode version.”
ERROR ITMS-90125: “The binary is invalid. 
The encryption info in the LC_ENCRYPTION_INFO load command is either missing 
or invalid, or the binary is already encrypted. This binary does not seem to 
have been built with Apple’s linker.”
WARNING ITMS-90080: "The executable 'XXX.app/Frameworks/PendoFramework.framework'
is not a Position Independent Executable. 
Please ensure that your build settings are configured to create PIE executables. For 
more information refer to Technical Q&A QA1788 - Building a Position Independent 
Executable in the iOS Developer Library."

Older versions of Xcode do not automatically strip out unused architecture from dynamic libraries. Add a step in the build chain to manually remove unused architectures using the script referenced in this article.