Example app for iOS SDK

The Exponea iOS SDK includes an example application you can use as a reference implementation. You can build and run the app, test Engagement features, and compare the code and behavior of your implementation with the expected behavior and code in the example app.

Prerequisites

You must have the following software installed to be able to build and run the example app:

In Xcode, navigate to Xcode > Preferences > Locations and make sure Command Line Tools is set to your Xcode version.

Build and run the example app

  1. Clone the exponea-ios-sdk repository on GitHub:
    git clone https://github.com/exponea/exponea-ios-sdk.git
  2. Run the following CocoaPods command:
    pod install
  3. Open the ExponeaSDK.xcworkspace file to open the project in Xcode.
  4. In the Project navigator in Xcode, select the ExponeaSDK project.
  5. Navigate to the Example application target's settings. On the General tab, find the Frameworks, Libraries, and Embedded Content section.
  6. Navigate to Product > Scheme and select Example.
  7. Select Product > Build (Cmd + B).
  8. Select Product > Run (Cmd + R) to run the example app in the simulator.
📘

To enable push notifications in the example app, you must also Configure Apple Push Notification Service for iOS SDK in the Exponea web app.

Navigate the example app

Example app screens: configuration, fetch, track, track event

When you run the app in the simulator, you'll see the Authentication view.

  1. Enter your project token, API token, and API base URL.
  2. Optional: Enter an Application ID if your Engagement project supports multiple mobile apps. If you leave this blank, the SDK uses the default value default-application. Learn more about Configuration for iOS SDK.
  3. Click Start to initialize the SDK.

>

The app provides several views, accessible using the bottom navigation, to test the different SDK features:

  • The Fetch Data view enables you to fetch recommendations and consents as well as open the app inbox.

    >

  • The Tracking view enables you to test tracking of different events and properties. The Custom Event and Identify Customer buttons lead to their separate views to enter test data.

    >

  • The Flushing view lets you trigger a manual data flush, anonymize the customer data, and log out.

    >

  • The Logging view displays log messages from the SDK.

    >

  • The In-app Content Blocks view displays in-app content blocks. Use placeholder IDs example_top, ph_x_example_iOS, example_list, example_carousel, and example_carousel_ios in your in-app content block settings.

    >

Try out the different features in the app, then find the customer profile in the Engagement web app (under Data & Assets > Customers) to see the properties and events tracked by the SDK.

Until you use Identify Customer in the app, the customer is tracked anonymously using a cookie soft ID. You can look up the cookie value in the logs and find the corresponding profile in the Engagement web app.

Once you use Identify Customer in the app to set the registered hard ID (use an email address as value), the customer is identified and can be found in Engagement web app by their email address.

📘

Refer to Customer identification for more information on soft IDs and hard IDs.

Example app screens: identify, flushing, logging, content blocks

Troubleshooting

If you encounter any issues building the example app, the following may help:

  • Remove the Pods folder and the Podfile.lock file from the project folder and rerun the pod install command.
  • In Xcode, select Product > Clean Build Folder (Cmd + Shift + K), then Product > Build (Cmd + B).

© Bloomreach, Inc. All rights reserved.