问题描述
我正在尝试使用 UserMessagingPlatform
来请求跟踪许可和欧盟 GDPR 同意。它在模拟器上运行时要求跟踪,但未显示欧盟同意对话框。怎么了?我已在 AdMob 的 Funding Choices 中创建了这两个选项。
适用于 iOS 和 Swift。
private func requestIDFA() {
if #available(iOS 14,*) {
ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
// Tracking authorization completed. Start loading ads here.
self.showConsent@R_431_4045@ion()
})
} else {
// Fallback on earlier versions
}
}
private func showConsent@R_431_4045@ion() {
let parameters = UMPRequestParameters()
// false means users are not under age.
parameters.tagForUnderAgeOfConsent = false
let debugSettings = UMPDebugSettings()
debugSettings.geography = UMPDebugGeography.EEA
parameters.debugSettings = debugSettings
UMPConsent@R_431_404[email protected](
with: parameters,completionHandler: { error in
if error != nil {
// Handle the error.
} else {
// The consent @R_431_4045@ion state was updated.
// You are Now ready to check if a form is
// available.
let formStatus = UMPConsent@R_431_404[email protected]
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 UMPConsent@R_431_404[email protected] == UMPConsentStatus.required {
form?.present(from: UIApplication.shared.windows.first!.rootViewController! as UIViewController,completionHandler: { dimissError in
if UMPConsent@R_431_404[email protected] == UMPConsentStatus.obtained {
// App can start requesting ads.
// initGoogleMobileAds()
}
})
}
}
})
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)