iOS & iPadOS / tvOS / watchOS

Apptimize supports experimentation and release management on iOS & iPadOS, tvOS, and watchOS through three separate SDKs. They are managed and released together and the installation instructions are very similar.

EU Cloud Site

Use the apptimizeOptions method to set your server region to EUCS if you are integrated in our EU Cloud site.

Objective-C
// If you're using the zero line setup (ApptimizeAppKey set in plist)
// Set following Keys to eucs (String) in Info.plist
ApptimizeServerRegion

// If you're using the in code setup (Apptimize startApptimizeWithApplicationKey)
// Add the following ApptimizeOptions to setup
NSString *apptimizeAppKey = @"[YOUR_APP_KEY]";
NSDictionary *apptimizeOptions = @{ApptimizeServerRegionOption: ApptimizeServerRegionEUCS);

[Apptimize startApptimizeWithApplicationKey:apptimizeAppKey options:apptimizeOptions];
Swift
// If you're using the zero line setup (ApptimizeAppKey set in plist)
// Set following Keys to eucs (String) in Info.plist
ApptimizeServerRegion

// If you're using the in code setup (Apptimize startApptimizeWithApplicationKey)
// Add the following ApptimizeOptions to setup
let apptimizeAppKey = "[YOUR_APP_KEY]"
let apptimizeOptions = [ApptimizeServerRegionOption : ApptimizeServerRegionEUCS]
Apptimize.start(withApplicationKey: apptimizeAppKey, options: apptimizeOptions)

SDK Installation

Sign in to the Apptimize dashboard. You’ll see a welcome page that asks for the name of your app. After entering all your info, you’ll see these installation instructions again.

You have three options for installing the SDK(s):

  1. Manual (Zero-Line) Installation
  2. CocoaPods
  3. Segment or mParticle Integration Kit

Manual (Zero-Line) Installation

The SDK switched from static to dynamic at version 2.18.0. Please remove the SDK from your project and follow the installation instructions below to upgrade.

  1. After you’re signed in, you’ll be able to download the Apptimize SDK. Unzip it, then drag and drop Apptimize.framework (iOS/iPadOS), ApptimizeTV.framework (tvOS), or ApptimizeWatch.framework (watchOS) into your project. You’ll probably want to check the Copy items if needed option.
../_images/AddFramework.png
  1. Select the project from the Project navigator.
  2. Select the target application. For watchOS this will be your watch application’s Extension target.
  3. Go to the General tab. Drag the Apptimize.framework, ApptimizeTV.framework, or ApptimizeWatch.framework from the project browser into the Frameworks, Libraries and Embedded Content section at the bottom of the page.
  4. Select Embed & Sign from the menu to the right of the added framework.
../_images/AddEmbedded.png

CocoaPods

Refer to CocoaPod’s Getting Started Guide for detailed instructions.

  1. Once you have created your Podfile, insert pod 'Apptimize' (iOS/iPadOS), pod 'Apptimize-tvOS' (tvOS), or pod 'Apptimize-watchOS' (watchOS) to import Apptimize as a dependency.

    Once you have done so, re-run pod install from the command line. Apptimize.framework is compatible with use_frameworks! for other dynamic and Swift dependencies.

Segment or mParticle Integration Kit

You can install our iOS SDK via our Segment or mParticle Integration Kits. You might want to use this option if you’re already tracking similar data with other services. This way, you can send your data to Segment or mParticle and with a flip of a switch, it will show up in Apptimize as well.

Learn more about our Integration Kits here!

Configure Your Project

  1. Select the project from the Project navigator.

  2. Select the target application. For watchOS this will be your watch application’s Extension target.

  3. Go to the General tab and verify minimum deployment target.

    iOS / iPadOS / tvOS

    Verify that your minimum deployment target is 11.0 or higher.

    watchOS

    Verify that your minimum deployment target is 5.0 or higher.

  4. In order to release on the App Store, you will need to strip all simulator architectures from the framework and embed swift libraries required by Apptimize. The following package contains scripts to run for iOS/iPadOS, tvOS, and watchOS targets.

    Download scripts: apptimize-build-scripts.zip

    iOS / iPadOS / tvOS

    Unzip the scripts archive and add the ios_tvos_strip.sh to your project directory. From the command line you will need to set the script as executable. Execute the following from the command line in the folder where you placed the script file:

    chmod +x ios_tvos_strip.sh
    

    In the Build Phases of your project target, click the + sign and select New Run Script Phase. Move the new run script so it is below the Embed Frameworks build phase (including any 3rd party framework embedding steps, including cocoa pods) and before any additional content is embedded (e.g. Embed Watch Content, Embed App Extensions, etc.). You may need to re-order some other steps to ensure this.

    Add the following code to the newly added run script. Note: If you placed the file in a subfolder of your project you will need to modify this path to match.

    ${SRCROOT}/ios_tvos_strip.sh
    

    Alternately you can copy the contents of the ios_tvos_strip.sh file into the run scipt, removing the first line reading #!/bin/sh.

    watchOS

    In the Build Settings of your Watch App target, search for the Always Embed Swift Standard Libraries setting and set it to YES.

    In the Build Settings of your Watch App Extension target, search for the Always Embed Swift Standard Libraries setting and set it to NO.

    Unzip the scripts archive and add the watchos_strip.sh to your project directory. From the command line you will need to set the script as executable. Execute the following from the command line in the folder where you placed the script file:

    chmod +x watchos_strip.sh
    

    In the Build Phases of your Watch App Extension target, click the + sign and select New Run Script Phase. Move the new run script so it is below the Embed Frameworks build phase (including any 3rd party framework embedding steps, including cocoa pods) and before any additional content is embedded.

    Add the following code to the newly added run script. Note: If you placed the file in a subfolder of your project you will need to modify this path to match.

    ${SRCROOT}/watchos_strip.sh
    

    Alternately you can copy the contents of the watchos_strip.sh file into the run scipt, removing the first line reading #!/bin/sh.

    Adding a Run Script
    ../_images/AddRunscript.png
    Embedding Swift Libraries
    ../_images/EmbedSwiftLibraries.png

Initializing Apptimize

  1. Open your project’s Info.plist (typically found in the Supporting Files folder), navigate to the Editor menu, and choose Add Item. If Add Item is grayed out, make sure to click the main window.

    ../_images/AddEditorItem-1.png

    Make sure to name your new entry ApptimizeAppKey.

    ../_images/AddApptimizeAppKey.png
  2. Add your application key, which is a 31 character key that can be found on the installation instructions while logged in or in your app settings.

    ../_images/SetApptimizeAppKey.png
  3. Build your app to make sure that SDK was installed correctly. Verify that the SDK is loading by running your app and checking the Xcode console for the message Apptimize: Version x.x.x.

    You’ve finished the Apptimize installation and are ready to configure your first A/B experiment!