Developer's Guide to Installing the Pendo Xamarin iOS SDK

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.

 

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.11 or greater
  • iOS 9.0 or greater

Pendo Setup and Initialization

The SDK initialization has three parts, importing the SDK, setting up the SDK to communicate with Pendo's servers, and starting a recording of a session. Setting up the communication with Pendo's server should be conducted once the application launches. Once connected, you may start the session recordings.

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. Recording a session can be conducted 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)

Install instructions 

  1. Select Settings > Subscription Settings > Add Another App and select the Xamarin iOS app type.

    xamarin_ios.png

  2. Note that in Pendo, two applications are created under the 'Subscription Settings' page (one for Android and one for iOS).

    xamarin_ios_android.png

  3. Select the app and select Continue to installation.

Step 1. Install Pendo Xamarin iOS SDK

The SDK package is installed using Visual Studio's Solution Explorer. Open your iOS app in Solution Explorer and follow the instructions to install the SDK. When this is complete, you need to setup and initialize Pendo to identify the user, collect data, and load guides.

  1. In Visual Studio Solution Explorer, right-click on your iOS project target and select "Add" - > "Add NuGet Packages…".
  2. If you are using Xamarin Forms 5, search pendo-sdk-ios-xamarin-forms,
    or
    Search for pendo-sdk-iOS.
  3. Press Add Package.

Step 2: Pendo SDK Integration

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.

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

 

Open the application AppDelegate class.

In the FinishedLaunching method in the AppDelegate class, add the following code:

If you are using Xamarin Forms 5, use this code:

using PendoForms;
string appKey = "eyJhbGciOiJSUzI1NiIsImtpZCI6IiIsInR5cCI6IkpXVCJ9.eyJkYXRhY2VudGVyIjoidXMiLCJrZXkiOiJiMmUzNGExNmIxOTdiZjI0YWRkZGU4NWQzYzg1Y2EyZjYwNWMwM2FhYTRhZWMzMTk3YzJiMzFhMzhlNzlmYmI4MzVjZDg0NmNiMDU1ZTA3ODZhNzdmNWM1YjExZjYzNjk2NWE2YjZjNjliNTc3Y2FhMGQ4NTcwZTZjOTAyMmUwNy40NTgzMmZlMzY5MDgxNTQ0ZjNjNGQ1YjgzMDViNzE3ZC5jM2Q4YjJkNGNjNmJhMDZjODRjODNlMWI4Y2M0OTg4ODRhZjIyOWYzZTYzZDc1MmQ1YTk4NGM2MWE3ZWZjN2Y0In0.NUAzwpK26NvaWFJpzUl2GTW_RwrWeUwleM4eKPLfD65PL3KEQQHy4pdX8-T18nmvYK_giir0_1mupSKM0ZR2Mx5r2E6K4UYq0YW4-n8sfLYNjNQGXZASBk07x9-LB2AUhtxaZQvfqi34Yt9r0BW-p6ynAjsXBSxX3hvYggHxoZ4";
PendoManager.Setup(appKey);

Otherwise, use this code:

 using Pendo;
 string appKey = "eyJhbGciOiJSUzI1NiIsImtpZCI6IiIsInR5cCI6IkpXVCJ9.eyJkYXRhY2VudGVyIjoidXMiLCJrZXkiOiJiMmUzNGExNmIxOTdiZjI0YWRkZGU4NWQzYzg1Y2EyZjYwNWMwM2FhYTRhZWMzMTk3YzJiMzFhMzhlNzlmYmI4MzVjZDg0NmNiMDU1ZTA3ODZhNzdmNWM1YjExZjYzNjk2NWE2YjZjNjliNTc3Y2FhMGQ4NTcwZTZjOTAyMmUwNy40NTgzMmZlMzY5MDgxNTQ0ZjNjNGQ1YjgzMDViNzE3ZC5jM2Q4YjJkNGNjNmJhMDZjODRjODNlMWI4Y2M0OTg4ODRhZjIyOWYzZTYzZDc1MmQ1YTk4NGM2MWE3ZWZjN2Y0In0.NUAzwpK26NvaWFJpzUl2GTW_RwrWeUwleM4eKPLfD65PL3KEQQHy4pdX8-T18nmvYK_giir0_1mupSKM0ZR2Mx5r2E6K4UYq0YW4-n8sfLYNjNQGXZASBk07x9-LB2AUhtxaZQvfqi34Yt9r0BW-p6ynAjsXBSxX3hvYggHxoZ4";
 PendoManager.SharedManager().Setup(appKey);

Start the visitor's session in the viewController where your visitor is being identified, for example, login, register, etc.

If you are using Xamarin Forms 5, use this code:

PendoManager.StartSession(
    visitorId,
    accountId,
    visitorData,
    accountData
);

Otherwise, use this code:

PendoManager.SharedManager().StartSession(
    visitorId,
    accountId,
    visitorData,
    accountData
);

visitorId: a user identifier (e.g. John Smith)
visitorData: the user metadata (e.g. email, phone, country, etc.)
accountId: an affiliation of the user to a specific company or group (e.g. Acme inc.)
accountData: the account metadata (e.g. tier, level, ARR, etc.)

This code will end the previous mobile session (if applicable), start a new mobile session and retrieve all guides based on the provided information.

Tip: Passing null or "" as the visitorId generates an anonymous visitor id.

 

Step 3: Mobile device connectivity for tagging and testing

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 Scheme to your scheme ID.

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

Add or modify openURL.

If you are using Xamarin Forms 5, use this code:

public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
{
  if (url.Scheme.Contains("pendo"))
  {
    PendoManager.InitWithUrl(url.AbsoluteString);
    return true;
  }
    //Your code here...
    return true;
}

Otherwise, use this code:

public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
{
  if (url.Scheme.Contains("pendo"))
  {
    PendoManager.SharedManager().InitWithUrl(url);
    return true;
  }
    //Your code here...
    return true;
}

 

Step 4: Verify your installation

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

Pendo SDK was successfully integrated and connected to the server.

2. Click to go through a verification process for the SDK integration.

3. Confirm that you can see your app under subscription settings as Integrated.

XamiOSIntegrated.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.
  • If you are encountering the following error: '-E -IIOJWT - Failed to create public key, which results in verification failure. OSStatus = ....', follow steps listed below:
    1. In the Visual Studio Editor - right click on the project.
    2. Select the 'Options' menu button.
    3. In the Build category list - Select the “iOS bundle signing” option.
    4. Select the three dots button of the “custom entitlements” field.
    5. Choose the “Entitlements.plist” file from the box and click the OK button.
  • Additional support can be foundhere