Show Menu

Install the Mobile SDK

In this lesson, you will implement the Mobile SDK with the extensions and settings corresponding to your Experience Platform Launch property's Development environment.

Learning Objectives

At the end of this lesson, you will be able to:
  • Obtain the installation instructions for your mobile Experience Platform Launch property
  • Understand the difference between a Development, Staging, and Production environment
  • Create and edit the Podfile
  • Import the Mobile SDK into your AppDelegate file
  • Verify that the SDK has been implemented successfully

Get the Installation Instructions

The Installation Instructions for mobile Experience Platform Launch properties are a collection of code snippets that you either run in your Terminal or add to specific locations in your mobile app.
Click on the Environments tab in the top navigation to go to the environments page. Note that Development, Staging, and Production environments have been pre-created for you. These correspond to the typical environments in the code development and release process. Code is first written by a developer in a Development environment. When they have completed their work, they send it to a Staging environment for QA and other teams to review. Once the QA and other teams are satisfied, the code is then published to the Production environment, which is the public-facing environment which your visitors experience when they download your app.
Experience Platform Launch permits additional Development environments, which is useful in large organizations in which multiple developers are working on different projects at the same time.
Development, Staging, and Production are the only environments we need to complete the tutorial.
In the Development row, click the Install icon to open the embed code modal.
Let's go through the instructions step-by-step.

Create the Podfile and Install the Pods

If you have previously used Experience Platform Launch in websites, one of the first things you will notice is that there is a lot more information in this modal than for web properties.
The Adobe Mobile SDK for iOS uses the CocoaPods to manage dependencies between its various components. If you don't already have CocoaPods installed in your development environment, follow the installation instructions on their website. Also, if you haven't already downloaded the Bus Booking app , save it to your local machine and extract the zip archive to your desktop.
To create the Podfile
  1. Open the Terminal Application on your MacĀ®
  2. Navigate to the project folder where you saved the Bus Booking Swift app (e.g. cd Desktop/busbooking-mobileapps-master/Swift/ )
  3. In the Experience Platform Launch interface, change the operating system to iOS
  4. Copy the first iOS instruction pod init , by clicking the icon
  5. In your Terminal app, run the pod init command and wait for it to complete
  6. In your Terminal app, open the podfile with the open podfile command
  7. Your computer may open a dialog asking with which application you would like to open the podfile. Choose any text editor, like TextEdit
  8. In the Experience Platform Launch interface, copy the list of dependencies by clicking the icon. Note how there is a line corresponding to each one of the extensions you added in the earlier lesson. Each extension has its own set of code which builds on the Mobile Core extension and can only be added or removed with an app update:
  9. In your text editor, paste the dependencies from your clipboard right after the line # Pods for BusBookingSwift
  10. Save the updates to the podfile in your text editor
  11. You can now close your text editor
  12. In the Experience Platform Launch interface, copy the next iOS instruction pod repo update , by clicking the icon
  13. In your Terminal app, run the pod repo update command and wait for it to complete (this might take a few minutes)
  14. In the Experience Platform Launch interface, copy the next iOS instruction pod install , by clicking the icon
  15. In your Terminal app, run the pod install command and wait for it to complete
  16. You can now close your Terminal window
  17. Open a Finder window, navigate to the folder where you saved the Bus Booking app, and confirm that the BusBookingSwift.xcworkspace file, the Podfile, the Podfile.lock file, as well as the Pods folder have been created

Update the AppDelegate

Now it's time to update the App to import the SDK
  1. Open the BusBookingSwift.xcworkspace file in Xcode
  2. Open the AppDelegate.swift file
  3. In the Experience Platform Launch interface, scroll to the Add Initialization Code section and choose Swift as the iOS language you are using.
  4. Copy the import statements, by clicking the first icon in the Add Initialization Code section:
  5. In Xcode, paste these import statements into the AppDelegate.swift file after the import for the UIKit
  6. In the Experience Platform Launch interface, copy the two lines related to the Core extension, by clicking the second icon in the Add Initialization Code section. The first line turns on console logging statements (available options are "debug", "verbose", "warning", and "error"). The second line points to the unique identifier of the Experience Platform Launch environment. This is important, as you will need to update this value when we are ready to deploy the app to the production environment.
  7. In Xcode, paste these Core statements into the AppDelegate file at the top of the application(_:didFinishLaunchingWithOptions:) method:
  8. In the Experience Platform Launch interface, copy the extension statements, by clicking the third icon in the Add Initialization Code section:
  9. In Xcode, paste these extension statements into the AppDelegate file just before the return true line of the application(_:didFinishLaunchingWithOptions:) method:
The Mobile Install Instructions provided in the Experience Platform Launch interface include the import and registration statements for Identity, Lifecycle, and Signal extensions, as well as the initialization of the Lifecyle metrics. These extensions are considered part of the Mobile Core extension. If you do not wish to use these extensions in your app, you do not need to import, register, or implement other code associated with these extensions.
Also, there are additional implementation options which should be considered when using these extensions (for example, you could pause/restart Lifecycle collection when the user backgrounds/foregrounds the app). You can read more about this in the Mobile Core extension documentation

Verify the implementation

  1. Save your Xcode project
  2. Run the app and launch it in the Simulator. If you don't have any simulator devices configured, configure one now, being sure to configure a device running iOS 10+. We like to use an iPhone 8 simulator because it is easy to click the Home button with a mouse.
  3. Wait for the Simulator to launch and fully open the app to the booking screen (this may take a few minutes)
  4. Confirm that calls are being made to the Adobe servers in the Xcode Console
Here are examples of some specific calls you can look for:
  1. Calls to retrieve the Experience Platform Launch configuration (filter your console to ). Note the extension configurations which you entered in the earlier lesson. While adding the extension requires an update to the app, these settings can be managed externally in Experience Platform Launch and changed at any time:
    2019-01-15 12:11:44.518220-0500 BusDemoSwift[52399:5056293] [AMSDK DEBUG <RulesDownloader>]: Successfully downloaded Rules from ''
  2. Request to the Identity Service (filter your console to ) In this example, the ID ( d_mid )has already been set and is just being reported up again)
    2019-01-15 12:11:45.164590-0500 BusDemoSwift[52399:5056322] [AMSDK DEBUG <com.adobe.module.identity>]:
    Sending request (
  3. Response from the Identity Service (filter your console to ID Service ). Note how the mid value matches the d_mid value in the request above:
    2019-01-15 12:11:45.681821-0500 BusDemoSwift[52399:5056322] [AMSDK DEBUG <com.adobe.module.identity>]:
    ID Service - Got ID Response (mid: 17179986463578698626041670574784107777, blob: j8Odv6LonN4r3an7LhD3WZrU1bUpAkFkkiY1ncBR96t2PTI, hint: 9, ttl: "604800000 ms")
  4. Analytics request (filter your console to Analytics request )
    2019-01-15 12:11:45.828465-0500 BusDemoSwift[52399:5056336] [AMSDK DEBUG <AnalyticsHitDatabase>]: Analytics request was sent with body
Congratulations, you've added the SDK to a mobile app!