Skip to content
Andrew Clunis edited this page Dec 13, 2022 · 25 revisions

Installation and Initialization

The Rover Campaigns SDK is a collection of Cocoa Touch Frameworks written in Swift. Instead of a single monolithic framework, the Rover Campaigns SDK takes a modular approach, allowing you to include only the functionality relevant to your application. The SDK is 100% open-source and available on GitHub.

Note: The Rover Campaigns SDK is used in concert with the main Rover SDK. The main Rover SDK renders graphical Rover content (Experiences), while this SDK (Rover Campaigns) offers additional marketing automation and analytics functionality. You don't need to worry about setting up the main Rover SDK; that is largely done for you by the Campaigns SDK.

Install the SDK

Note: Historically, you may have had the Rover Bluetooth module present. It introduces an additional permission prompt on iOS 13, and no longer adds much value (the rarely used isBluetoothEnabled field in Audience), and so it should typically be removed. See our Bluetooth Deprecation guide.

Install the SDK

SwiftPM

The recommended way to install the Rover Campaigns SDK is via SwiftPM.

In Xcode, in your Project Settings, under Package Dependencies, add a new dependency with the URL of this repository: https://github.com/roverplatform/rover-campaigns-ios.

Note that as of Xcode 13, you have to type the repository URL into the search box and press return.

Leave the dependency rule at the default, "Up To Next Major Version". Rover follows the standard semver semantic versioning rules.

Then, in the subsequent dialog box, choose the Package Products (frameworks) you wish to use.

Initialize the Rover Campaigns SDK

The shared Rover Campaigns instance is initialized with a set of assemblers. Each assembler has its own parameters but the only one that is required is the accountToken parameter on the DataAssembler.

You can learn more about assemblers and their parameters at Customizing Services.

You can find your accountToken token in the Rover Settings app. Find the token labelled "SDK Token" and click the icon next to it to copy it to your clipboard.

From within your application(_:didFinishLaunchingWithOptions:) method call the RoverCampaigns.initialize(assemblers:) method passing in the assemblers for each of the Rover modules you want to use. Replace YOUR_SDK_TOKEN in the below code sample with the token you copied from the Rover Settings app.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // ...
    // Initialize Rover Campaigns with its modules
    RoverCampaigns.initialize(assemblers: [
        FoundationAssembler(),
        DataAssembler(accountToken: "YOUR_SDK_TOKEN"),
        UIAssembler(),
        ExperiencesAssembler(),
        NotificationsAssembler(),
        LocationAssembler(),
        DebugAssembler()
    ])
    return true
}
Clone this wiki locally