How to integrate UniConsent CMP SDK for iOS with mobile apps

UniConsent CMP is a package for handling GDPR IAB TCF 2.2 consent management in IOS. You can find a demo app integrated with UniConsent CMP in the "uniconsent_demo" directory.


  • UniConsent CMP plan with Mobile app support
  • iOS >= 14.0
  • UniConsent CMP SDK package (request from support)

Getting started

Add UniConsent.framework into your project, make sure it is Embed & Sign.


To use the UniConsent CMP in your app, follow these steps:

Initialize the CMP with an App ID from your account manager:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Init CMP with appId
    UniConsent.shared.initialize(apiId: "YOUR_APP_ID_CHANGE_THIS")
    return true

Display the CMP UI:

// Display CMP UI
UniConsent.shared.launchCMP(rootVC: self)

Automatically check if consent is expired when the vendorList updates:

// Automatic check if consent is expired when vendorList updates

Get the tcString if required:

// Get tcString if requried

Read the consent status:

// Read consent status
UniConsent.shared.isAllowPurposeById(purposeId: 1)

Reset consent status if required:

// Reset consent status if required:

Setup default consent status KV:



Control analytics based on the consent flags:

public func onDismiss() {

    if(UniConsent.shared.isAllowPurposeById(purposeId: 1)) {
          .analyticsStorage: .granted,
          .adStorage: .granted,
          .adUserData: .granted,
          .adPersonalization: .granted,
    } else {
          .analyticsStorage: .denied,
          .adStorage: .denied,
          .adUserData: .denied,
          .adPersonalization: .denied,

Find more info at Set up consent mode for apps


  1. Users should have the ability to access a "Privacy Settings" button or link in the settings section of your application in order to open the CMP UI.
  2. You can utilize the shouldRequestConsent() function to check whether you should request new consent based on the status. Display the CMP UI as needed when a user opens the application.