Applying IAB Consent (TCString)¶
As specified by the IAB, the consent collected will be encoded and stored locally in NSUserDefaults
(iOS) or SharedPreferences
(Android).
You may access these values with their specific Keys, but most third-party Frameworks will have listeners to apply this consent automatically.
let defaults = UserDefaults.standard
let tcString = defaults.string(forKey: "IABTCF_TCString")
let cmpsdkID = defaults.integer(forKey: "IABTCF_CmpSdkID")
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
val tcString = preferences.getString("IABTCF_TCString")
val cmpsdkID = preferences.getInt("IABTCF_CmpSdkID")
Alternatively, we have also enabled the method:
UsercentricsCore.shared.getTCFData() { tcfData in
let tcString = tcfData.tcString
}
Usercentrics.instance.getTCFData { tcfData ->
val tcString = tcfData.tcString
}
Usercentrics.getTCString();
import { Usercentrics } from '@usercentrics/react-native-sdk';
const tcString = await Usercentrics.getTCFString();
Applying Non-IAB Consent¶
Additionally to the IAB Purposes, you might want to complete your consent coverage with Non-IAB Services. Please see Apply Service Consent