【问题标题】:Why is my Google AdMob GDPR consent form not presented in my iOS app为什么我的 iOS 应用中没有显示我的 Google AdMob GDPR 同意书
【发布时间】:2022-10-13 14:28:50
【问题描述】:

我正在将 UMP SDK 实施到我的 iOS 应用程序中。我在 Google AdMob 信息中心的隐私和消息部分设置了 GDPR 和 IDFA 消息。我无法显示 GDPR 消息。 IDFA 和 iOS 的 ATT 消息完美运行。

下面是我正在使用的代码。我已经在模拟器和物理设备上对此进行了测试。另外,我位于欧盟。

static func trackingConsentFlow(completion: @escaping () -> Void) {
    let umpParams = UMPRequestParameters()
    let debugSettings = UMPDebugSettings()
    debugSettings.geography = UMPDebugGeography.EEA
    umpParams.debugSettings = debugSettings
    umpParams.tagForUnderAgeOfConsent = false
    
    UMPConsentInformation
        .sharedInstance
        .requestConsentInfoUpdate(with: umpParams,
                                  completionHandler: { error in
            if error != nil {
                print("MYERROR #1 \(String(describing: error))")
                completion()
            } else {
                let formStatus = UMPConsentInformation.sharedInstance.formStatus
                print("FORM STATUS: \(formStatus)")
                
                if formStatus == .available {
                    loadForm(completion)
                } else {
                    completion()
                }
            }
    })
}

private static func loadForm(_ completion: @escaping () -> Void) {
    UMPConsentForm.load(completionHandler: { form, loadError in
        if loadError != nil {
            print("MYERROR #2 \(String(describing: loadError))")
            completion()
        } else {
            print("CONSENT STATUS: \(UMPConsentInformation.sharedInstance.consentStatus)")
            if UMPConsentInformation
                .sharedInstance.consentStatus == .required {
                
                guard let rootViewController = UIApplication.shared.currentUIWindow()?.rootViewController else {
                    return completion()
                }
                
                form?.present(from: rootViewController, completionHandler: { dismissError in
                    if UMPConsentInformation
                        .sharedInstance.consentStatus == .obtained {
                        completion()
                    }
                })
            }
        }
    })
}

只是要清楚:

使用此代码,我可以显示 IDFA 消息,然后显示 AppTrackingTransparency 警报。但我希望也能看到 GDPR 同意书。

【问题讨论】:

    标签: ios swift admob gdprconsentform ump


    【解决方案1】:

    对于任何想知道同样事情的人。 GDPR 消息未显示,因为我尚未完成 Admob 帐户设置。我没有添加我的付款方式。添加它(并在 Admob 中发送应用程序以供审核)后,GDPR 消息开始出现。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      • 2013-07-04
      • 1970-01-01
      • 2011-04-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多