iOS & iPadOS / tvOS / watchOS / Catalyst (macOS)

Apptimize supports experimentation and release management on iOS & iPadOS + Catalyst (macOS), tvOS, and watchOS through a single SDK. The instructions are the same for all platforms.

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. Swift Package Manager

  3. CocoaPods

  4. 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.xcframework into your project. You’ll probably want to check the Copy items if needed option.

    ../_images/AddFramework.png
  2. Select the project from the Project navigator.

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

  4. Go to the General tab. Drag the Apptimize.xcframework from the project browser into the Frameworks, Libraries and Embedded Content section at the bottom of the page.

  5. Select Embed & Sign from the menu to the right of the added framework.

    ../_images/AddEmbedded.png

Swift Package Manager

  1. Open your project in XCode.

  2. From the File menu, select Swift Packages > Add package dependency…

    ../_images/AddSwiftPackage-1.png
  3. Select the project(s) to which you want to add Apptimize.

  4. Add the package url https://github.com/urbanairship/apptimize-ios-kit and click Next.

    ../_images/AddSwiftPackage-2.png
  5. If you need a specific version you can change it on this screen, otherwise you should accept the default version and Up to Next Major and click Next.

    ../_images/AddSwiftPackage-3.png

CocoaPods

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

  1. Apptimize is distributed as an XCFramework and that requires that you are running a cocoapods version 1.10.0 or newer. To update you simply need to install the gem again.

    $ [sudo] gem install cocoapods
    
  2. Once you have created your Podfile, insert pod 'Apptimize' to import Apptimize as a dependency.

    Once you have done so, re-run pod install from the command line. Apptimize.xcframework 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.

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!

Additional SDK Usage Notes

EU Cloud Site

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

iOS (Objective-C)
// Be sure to import the Apptimize SDK at the top of your objective-c file
#import <Apptimize/Apptimize.h>

// 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];

Tests Targeting Catalyst

You can target your tests to Catalyst by setting a platform filter for iOS and adding adding where Is Catalyst with a value of is true.

../_images/CatalystTargetting.png