【问题标题】:EU Consent dialog not shown未显示欧盟同意对话框
【发布时间】:2021-03-28 13:37:18
【问题描述】:

我正在尝试使用 UserMessagingPlatform 请求跟踪许可和欧盟 GDPR 同意。它要求在模拟器上运行时进行跟踪,但未显示欧盟同意对话框。怎么了?我在 AdMob 的资金选择中都创建了。

这是在 iOS 和 Swift 上。

    private func requestIDFA() {
        if #available(iOS 14, *) {
            ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
                // Tracking authorization completed. Start loading ads here.
                self.showConsentInformation()
            })
        } else {
            // Fallback on earlier versions
        }
    }

  private func showConsentInformation() {
            let parameters = UMPRequestParameters()
            
            // false means users are not under age.
            parameters.tagForUnderAgeOfConsent = false
            let debugSettings = UMPDebugSettings()
            debugSettings.geography = UMPDebugGeography.EEA
            parameters.debugSettings = debugSettings

            UMPConsentInformation.sharedInstance.requestConsentInfoUpdate(
                with: parameters,
                completionHandler: { error in
                    if error != nil {
                        // Handle the error.
                    } else {
                        // The consent information state was updated.
                        // You are now ready to check if a form is
                        // available.
                        let formStatus = UMPConsentInformation.sharedInstance.formStatus
                        if formStatus == UMPFormStatus.available {
                            self.loadForm()
                        }
                    }
                })
            
        }
    
    func loadForm() {
        UMPConsentForm.load(
            completionHandler: { form, loadError in
                if loadError != nil {
                    // Handle the error
                } else {
                    // Present the form
                    if UMPConsentInformation.sharedInstance.consentStatus == UMPConsentStatus.required {
                        form?.present(from: UIApplication.shared.windows.first!.rootViewController! as UIViewController, completionHandler: { dimissError in
                            if UMPConsentInformation.sharedInstance.consentStatus == UMPConsentStatus.obtained {
                                // App can start requesting ads.
                                // initGoogleMobileAds()
                            }
                        })
                    }
                }
            })
        }

【问题讨论】:

    标签: admob gdprconsentform


    【解决方案1】:

    我认为 AdMob 可能将模拟器视为一种特殊情况。谷歌是这样说的:

    模拟器不需要像他们一样添加到设备 ID 列表中 默认启用测试。

    也许尝试使用 Force a geography

    部分下解释的调试代码 here 对其进行调整是有意义的

    我遇到了另一个奇怪的问题:我位于欧盟以外的测试 iPhone 在全新安装的初始运行时始终显示 GDPR 表格,因为 UMP 以某种方式不断将许可状态返回为“必需”。我希望它返回“notRequired”,但它没有发生。似乎 AdMob 无法检测我的 iPhone 是否在欧盟。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-11
      • 2013-06-28
      • 2016-05-30
      • 2017-02-05
      • 2017-07-03
      相关资源
      最近更新 更多