Initial setup

Integrating the SDK

Native SDK

The iOS SDK is a standard mergeable dynamic library, compatible with iOS 13.0 and higher. Xcode 15.3+ is required, but Batch will work with all Swift versions, along with Objective-C.

It supports the following architectures:

  • x86_64

  • arm64 (both for iOS, and iOS Simulator on Apple Silicon)

  • arm64e.

Catalyst is supported.

The iOS SDK also supports visionOS in a restricted usage since:

  • In-App messaging and mobile landings are unavailable.

  • In-App rating is not supported on visionOS due to an OS limitation.

Integrating with:

Use Xcode's Swift Package Manager wizard to add

Package.swift
https://www.github.com/BatchLabs/Batch-iOS-SDK.git

Your first start

Implement the Batch startWithAPIKey: method in your AppDelegate application:didFinishLaunchingWithOptions: method:

If you're making a SwiftUI app, you will need to add a delegate first.

import Batch
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    BatchSDK.start(withAPIKey: "YOUR_API_KEY")
    [..]
}

YOUR_API_KEY is your SDK API Key. You'll find it in ⚙ Settings → General.

This API key must not be mistaken for the APNS environment Batch will output to the Xcode logs when starting. The environment depends on the app's provision, not on the Batch API Key used.

Testing your integration

Congratulations on finishing the bulk of the integration!

If you want to validate your implementation before proceeding with the Push setup, you can locate the log that Batch posts in the Xcode console.

[Batch] Installation ID: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Batch also provides a simple debug tool that allows you to test your integration (⚙ Settings → Debug) and a profile view that shows all the data available for a specific user ID.

Last updated

Was this helpful?