---
metadata:
  - name: generator
    content: Diplodoc Platform v5.55.0
alternate:
  - https://ads.yandex.com/helpcenter/en/dev/ios/tcf-2-0.md
  - https://ads.yandex.com/helpcenter/ru/dev/ios/tcf-2-0.md
  - https://ads.yandex.com/helpcenter/zh/dev/ios/tcf-2-0.md
  - href: zh/dev/ios/tcf-2-0.md
    type: text/markdown
    title: Markdown version
  - href: llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/zh/llms.txt

# TCF v2.0 同意



如果您为用户同意流程实施了符合 IAB [透明度和同意框架](https://iabeurope.eu/tcf-2-0/) (TCF) v2.0 的同意管理平台 (CMP)，则Yandex Mobile Ads SDK 支持发送 TCF v2.0 值。

Yandex Mobile Ads SDK 使用以下键从 `UserDefaults` 读取 TCF v2.0 同意字符串：

#|
|| IABTCF_TCString | 字符串 | 完全编码的 TC 字符串。||
|| IABTCF_gdprApplies | 数值 |
* 1：GDPR 适用于当前情况；
* 0：GDPR 不适用于当前情况；
* 取消设置：未定义（初始化前的默认值）。||
|| IABTCF_CmpSdkID | 数值 |使用的经过认证的 CMP 的无符号整数 ID。||
|| IABTCF_PurposeConsents | 二进制字符串 | 位置 N 上的“0”或“1”，其中 N 从 0 开始索引，表示针对 ID 为 N+1 的目的的同意状态。“0”表示 `false`，“1”表示 `true`。例如，索引为 0 的“1”表示已对 ID 为 1 的目的给出同意。||
|| IABTCF_VendorConsents | 二进制字符串 | 位置 N 上的“0”或“1”，其中 N 从 0 开始索引，表示针对 ID 为 N+1 的供应商的同意状态。“0”表示 `false`，“1”表示 `true`。例如，索引为 0 的“1”表示已对 ID 为 1 的供应商给出同意。||
|| IABTCF_AddtlConsent | 字符串 | AC 字符串，包含用户已同意的广告技术提供商的规范版本和 ID。||
|#

如需详细了解，请参阅 [IAB 文档](https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md)。

## 将值传递至 UserDefaults

在进行广告请求之前，请确保传递键值。使用认证的 CMP 来传输这些值。您可以在 [此处](https://iabeurope.eu/cmp-list)找到 IAB 推荐的最新 CMP 列表。获得用户同意后，CMP 会根据键将所有数据写入 `UserDefaults`，而 Yandex Mobile Ads SDK 会自动读取这些数据。

