Download and Import the SDK

Download Options

  1. Download from Cocoapods (SDK framework only, no demo app)
  2. Download from Swift Package Manager (SDK framework only, no demo app)
  3. Download from OneTrust Tenant (SDK framework and demo app)

Download from Cocoapods

👍

Cocoapods version

OneTrust recommends keeping your Cocoapods version within the last 2 versions. If you experience any issues downloading and running the Cocoapods OneTrust framework, please check or upgrade this version first.

  1. Add the pod reference to your podfile:
// replace the version with your desired version
pod 'OneTrust-CMP-XCFramework', '~> 202505.1.0.0'

pod 'OneTrust-CMP-tvOS-XCFramework', '~> 202505.1.0.0'
  1. Run pod install in your project directory.
  2. Open App.xcworkspace and build.

Download from Swift Package Manager

📘

Notice

  • If the application target has previously been using the .framework or .xcframework file, remove/delete all references of it from target's build or general settings before adopting the Swift Package
    • Delete the existing OTPublishersHeadlessSDK.framework or OTPublishersHeadlessSDK.xcframework from the application target
    • Remove OTPublishersHeadlessSDK.framework or OTPublishersHeadlessSDK.xcframework from 'Embedded Frameworks' and 'Link Binary With Libraries' under the application target's 'Build Phases' tab if not automatically removed
  1. Open the application project or workspace.
  2. Select File > Add Package Dependencies
  3. Enter the URL for the corresponding Swift package you want to integrate and click enter.
  1. Choose the Dependency Rule that is appropriate for your project. The package version you install should usually match the SDK version that's been published in the OneTrust tenant/admin console
  2. Choose the Project to add the package to
  3. Click Add Package

📘

All the steps mentioned above are only required the first time the application target is being linked with the OT SDK Swift Package. After this is done and on subsequent releases, the application can directly fetch the latest OT SDK package with the following path: File > Packages > Update to Latest Package Version.


Download from OneTrust Tenant/Admin Console

  1. Log in to your OneTrust tenant/admin console
  2. Head to Mobile App Consent > SDKs > Your app > SDK > Select the framework you'd like to download (Native, Unity, MAUI)
  3. Select the SDK version to download under Select API Version
  4. Download SDK
  1. Unzip the file and add the iOS or tvOS .xcframework file into your Xcode project
Folder StructureFile/Folder NameDescription
OTPublishersHeadlessSDK-XCFramework > XCode_15.2 > OTPublishersHeadlessSDK-15.2 > OTPublishersHeadlessSDK.xcframework OTPublishersHeadlessSDK.xcframeworkXCFramework ensures forward compatibility with versions after XCode 11.1.
This also automatically removes the simulator architectures when users are ready for production without having to manually switch between "testing" and "release ready" frameworks
OTPublishersHeadlessSDK-XCFramework > XCode_15.2 > OTPublishersHeadlessSDKtvOS-15.2 > OTPublishersHeadlessSDKtvOS.xcframeworkOTPublishersHeadlessSDKtvOS.xcframeworkXCFramework ensures forward compatibility with versions after XCode 11.1.
This also automatically removes the simulator architectures when users are ready for production without having to manually switch between "testing" and "release ready" frameworks

🚧

Once added to your Xcode project, verify that:

  • OTPublishersHeadlessSDK.xcframework is added to Frameworks, Libraries, and Embedded Contents under target's General tab.
  • OTPublishersHeadlessSDK.xcframework is Embedded and Signed

Import the SDK

After adding the SDK to your application, you must import it to begin accessing its methods.

iOS

import OTPublishersHeadlessSDK

tvOS

import OTPublishersHeadlessSDKtvOS

Why is the iOS and tvOS SDK separate?

The tvOS SDK still uses iOS's `OTPublishersHeadlessSDK as the class and so the business logic is essentially identical. This makes sharing and reusing code between iOS and tvOS easier. The library was bifurcated into two frameworks in order to keep the architectures and view controllers separate, otherwise the size would be too large to deploy through package managers.

Why is XCFramework recommended?

We recommend XCframework because Apple recommends it. They introduced the feature in WWDC19 and XCode 11.

👍

For more information, watch the Tech Talk from WWDC19.