iOS/tvOS Installation

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

You have three options for installing the iOS/tvOS SDK: Manual (Zero-Line) Installation, CocoaPods, or Segment.

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 iOS/tvOS SDK. Unzip it, then drag and drop Apptimize.framework (iOS) or ApptimizeTV.framework (tvOS) into your project. You’ll probably want to check the Copy items if needed option.
../_images/AddFramework.png
  1. Select the project and go to the General tab. Drag the Apptimize.framework or ApptimizeTV.framework from the project browser into the Embedded Binaries section at the bottom of the page.
../_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) or pod 'Apptimize-tvOS' (tvOS) 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.

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
  1. 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
  1. In order to release on the App Store, you will need to strip all simulator architectures from the framework. In the Build Phases of your project target, click the + sign and select New Run Script Phase.
../_images/ios_addrunscript.png

Be sure the new run script is below the Embed Frameworks build phase.

Then, add the following code to the newly created Run Script:

cd "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Apptimize.framework/"
if [[ ! "${SDKROOT}" == *Simulator* ]]; then
  lipo Apptimize -verify_arch i386 && lipo -remove i386 -remove x86_64 Apptimize -output Apptimize || echo "Simulator architectures already stripped"
else
  lipo Apptimize -verify_arch i386 || { echo "Simulator architectures missing - clean and rebuild for simulator!"; exit 1; }
fi

Your final build phases should look similar to this:

  1. 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 2.x.x.

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

Segment

You can install our iOS SDK via our Segment integration. You might want to use this option if you’re already tracking similar data with other services as you only need to send that data to Segment once and will show up in Apptimize and other integrations with the flip of a switch.

Get started by signing up for a Segment account if you haven’t already and follow the installation instructions. Once you’ve installed Segment, flip the Apptimize switch on the Segment dashboard, enter in your Apptimize app key and you’re ready to go!