Installing the Mailchimp Mobile SDK for iOS

At a glance

This article walks you through the process of installing and configuring the Mailchimp SDK for iOS.

Optional: To build the SDK from source code, run bundle exec fastlane create_binary_framework.

What you’ll need

  • Deployment target iOS 11.0 or above

  • Xcode version 11 or above

  • Ruby 2.4 or above (for fastlane)

Obtain the SDK Key

Before you begin, you'll need to obtain a Mobile SDK key so you can access and configure the SDK.

  1. Go to the Your API Keys section of your Mailchimp account and click on Your Mobile SDK Client

  2. If a key exists, copy it to your clipboard and skip to “Add the XCFramework”

  3. If you need to create a new key, click Create A Key

  4. Select an audience, and then name your key descriptively

  5. Click Create Key

Note: The Mobile SDK key does not provide access to the Mailchimp Marketing API but should still be considered private and kept safe.

Installation

Option 1. Cocoapods

For the latest version of our SDK, add the following to your project’s Podfile:

pod 'MailchimpSDK'

Option 2. Manual

  1. Clone this repository.

  2. Run bundle exec fastlane create_binary_framework to build the Swift binary framework for iOS and iOS Simulator.

  3. Add the XCFramework.

  4. Click on the Project navigator, select your app’s target, go to the General tab, scroll down to Frameworks, Libraries, and Embedded Content. Drag the Mailchimp.xcframework from this repo into this section.

Initialize the SDK

The initialize method has three different fields.

  • SDK Key (Required): The SDK key gives you access to your audience.

  • Debug Mode (Optional): Debug Mode enables additional debug only functionality such as extra logging. This is off by default.

  • Auto Tagging (Optional): Auto Tagging automatically tags contacts with information such as Device Type and Platform. This is on by default.

MailchimpSDK.initialize(token: sdkKey)

Next steps

Congratulations! You've successfully installed the Mobile SDK for iOS. To learn how to use it, see Using the Mobile SDK for iOS.