ios - 为什么 admob 同意书未在实际设备上加载?
问题描述
我正在尝试为我的 iOS 应用程序实现 Admob。表单加载到 Xcode 模拟器设备上。我位于美国,但我使用以下代码来测试 Consent SDK 是否适用于欧洲用户。当我将它与模拟器一起使用时,会加载表单和广告。
PACConsentInformation.sharedInstance.debugIdentifiers = ["SPECIFIC_TO_MY_DEVICE"]
PACConsentInformation.sharedInstance.debugGeography = PACDebugGeography.EEA
使用此配置,表单不会加载到我的物理设备上。testflight
当我过去将测试版本分发给欧盟的测试用户时,该表单也没有加载。随后,广告没有在“欧洲”设备上加载。
当表单应该加载时,我从下面的代码块中得到一个错误。还。我得到错误WebKitDomain Error 101
。我的 ATS 设置是在plist
每个 Admob 文档中设置的。
thisForm.load {(_ error: Error?) -> Void in
if let error = error {
print("Error loading form: \(error.localizedDescription)")
//I am getting the error here.
} else {
thisForm.present(from: self) { (error, userPrefersAdFree) in
print("in present handler")
if let error = error {
// Handle error.
print("error presenting: \(error.localizedDescription)")
} else if userPrefersAdFree {
//TODO: find a way to disable ads
} else {
// Check the user's consent choice.
//let status = PACConsentInformation.sharedInstance.consentStatus
}
}
}
有谁知道物理设备可能导致这些错误的原因是什么?我尝试过使用真实的广告 ID 和测试广告 ID。
解决方案
仅在以下情况为真时出示同意书
If requestLocationInEEAOrUnknown == true {
//present consent form
}
else {
//do whatever is needed
}
推荐阅读
- python - 如何使用数组将包含具有 250 个变量的 JSON 的单列转换为 250 个单独的列数据集?
- mule - Mule Flow 仅用于集成测试
- java - 我们可以为特定的 URI 启用 Spring Boot 压缩吗?
- qt - 从函数发出信号时出现 QT 错误
- python - 使用 PyMongo 在不同系统上连接 MongoDB
- mysql - MYSQL 查找每月交易的用户数
- powershell - Powershell 仅从 Get-ADUser 获取与字符串模式匹配的属性
- angularjs - zsh:找不到命令:nx
- javascript - 在 React js 中的一个页面中提交表单时在另一个页面中通知
- pytorch - 函数 CudnnConvolutionBackward 在索引 1 处返回无效梯度 - 得到 [294, 592, 1, 1] 但预期形状与 [294, 768, 1, 1] 兼容