Example App

Build, run, and navigate the example app included with the 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. Run the following Carthage command:
    carthage update --use-xcframeworks --platform iOS
    
  4. Open the ExponeaSDK.xcworkspace file to open the project in Xcode.
  5. In the Project navigator in Xcode, select the ExponeaSDK project.
  6. Navigate to the Example application target's settings. On the General tab, find the Frameworks, Libraries, and Embedded Content section.
  7. Open Finder, navigate to the Carthage/Build folder inside the exponea-ios-sdk folder, and drag and drop every *.xcframework folder inside it to the Frameworks, Libraries, and Embedded Content section in Xcode.
  8. Navigate to Product > Scheme and select Example.
  9. Select Product > Build (Cmd + B).
  10. 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 the Apple Push Notification Service integration 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. Enter your project token, API token, and API base URL, then click Start to initialize the SDK.

AuthenticationViewController.swift

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

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.
  • Remove the Carthage folder and the Cartfile.resolved file from the project folder and rerun the full carthage update command above.
  • In Xcode, select Product > Clean Build Folder (Cmd + Shift + K), then Product > Build (Cmd + B).