Skip to main content

Overview

The User Messaging Platform (UMP) SDK helps you manage user consent for personalized advertising in compliance with GDPR (General Data Protection Regulation) and CCPA (California Consumer Privacy Act).
UMP integration requires the adrop-ads-backfill module. Make sure you have completed the Getting Started installation guide first.

Basic Usage

Use the Consent Manager to request user consent after initializing Adrop.
import AdropAds

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Call after Adrop.initialize()
        Adrop.consentManager?.requestConsentInfoUpdate(from: self) { result in
            if let error = result.error {
                print("Consent error: \(error)")
            }
        }
    }
}

The requestConsentInfoUpdate callback returns an AdropConsentResult object with the following properties:
PropertyTypeDescription
statusAdropConsentStatusCurrent consent status
canRequestAdsBoolWhether ads can be requested
canShowPersonalizedAdsBoolWhether personalized ads can be shown
errorError?Error if the request failed
Adrop.consentManager?.requestConsentInfoUpdate(from: self) { result in
    print("Status: \(result.status)")
    print("Can request ads: \(result.canRequestAds)")
    print("Can show personalized ads: \(result.canShowPersonalizedAds)")

    if let error = result.error {
        print("Error: \(error)")
    }
}

The consent manager returns one of the following statuses:
StatusDescription
unknownConsent status not yet determined
requiredConsent required (popup will be shown)
notRequiredConsent not required (non-GDPR region)
obtainedConsent already obtained

Debug Settings (Test Mode)

Test GDPR/CCPA consent flows during development:
import AdropAds

#if DEBUG
// Set debug geography before requesting consent
Adrop.consentManager?.setDebugSettings(
    testDeviceIdentifiers: ["YOUR_DEVICE_IDENTIFIER"],  // Check Xcode console
    geography: .EEA  // Test GDPR
)

// Reset consent for testing
Adrop.consentManager?.reset()
#endif

Debug Geographies

GeographyDescription
disabledUse actual device location
EEATest GDPR (European Economic Area)
regulatedUSStateTest CCPA (California, etc.)
otherTest non-regulated regions
Debug settings should only be used during development. Remove or disable them before releasing to production.

Additional Methods

MethodReturn TypeDescription
getConsentStatus()AdropConsentStatusReturns the current consent status
canRequestAds()BoolReturns whether ads can be requested based on consent
reset()VoidResets consent information
// Check consent status independently
if let status = Adrop.consentManager?.getConsentStatus() {
    switch status {
    case .obtained:
        print("Consent obtained")
    case .required:
        print("Consent required")
    case .notRequired:
        print("Consent not required")
    case .unknown:
        print("Consent status unknown")
    }
}

// Check if ads can be requested
if Adrop.consentManager?.canRequestAds() == true {
    // Load ads
}

// Reset consent (for testing)
Adrop.consentManager?.reset()

Best Practices

Request Early

Request consent as early as possible in your app lifecycle, ideally right after SDK initialization.

Handle Errors

Always handle consent errors gracefully and provide fallback behavior.

Test All Scenarios

Use debug settings to test all consent scenarios (required, not required, obtained) before release.

Respect User Choice

Once consent is obtained or declined, respect the user’s choice and don’t repeatedly ask.

Targeting

Set up user and context targeting

Getting Started

SDK installation and setup guide

Reference

Classes, delegates, and error codes