ios - Admob GDPR 同意对话框每次返回欧盟时都会弹出?
问题描述
我在 Admob 同意对话框中遇到了奇怪的行为,每次我在国外几天后返回英国时,GPDR admob 对话框再次弹出,我必须再次同意。
下面是我正在使用的代码:
// PACConsentInformation.sharedInstance.debugGeography = .EEA;
PACConsentInformation.sharedInstance.requestConsentInfoUpdate( forPublisherIdentifiers: ["pub-XXXXX"])
{(_ error: Error?) -> Void in
if let error = error
{
print("[GDPR][CHECK] Error updateing \(error)")
} else
{
print("[GDPR][CHECK] Updated")
let status = PACConsentInformation.sharedInstance.consentStatus
if status == PACConsentStatus.personalized
{
print("[GDPR][CHECK] User selected personalized")
user_info().set(key: user.gdpr_nonPersonalized, value: false)
}else
if status == PACConsentStatus.nonPersonalized
{
print("[GDPR][CHECK] User selected none-personalized")
user_info().set(key: user.gdpr_nonPersonalized, value: true)
}else
//unknown !!
if status == PACConsentStatus.unknown && PACConsentInformation.sharedInstance.isRequestLocationInEEAOrUnknown == true
{
print("[GDPR][CHECK] unkown !")
APP_DELEGATE.showGDPRDialog(from: self)
}else
{
print("[GDPR][CHECK] unkown ! user outside EU" )
user_info().set(key: user.gdpr_nonPersonalized, value: false)
}
}
}
//[GDPR] Dialog
func showGDPRDialog( from:UIViewController)
{
guard let privacyUrl = URL(string: "http://xx/privacy-policy"),
let form = PACConsentForm(applicationPrivacyPolicyURL: privacyUrl) else {
print("[GDPR] incorrect privacy URL.")
return
}
form.shouldOfferPersonalizedAds = true
form.shouldOfferNonPersonalizedAds = true
form.shouldOfferAdFree = false
form.load {(_ error: Error?) -> Void in
print("[GDPR] FORM Load complete.")
if let error = error {
// Handle error.
print("[GDPR] FORM Error loading form: \(error.localizedDescription)")
} else
{
print("[GDPR] success will present.")
// Load successful.
user_info().set(key: user.gdpr_dialog_showed, value: true)
form.present(from: from) { (error, userPrefersAdFree) in
APP_DELEGATE.logEvent("opened_gdpr", [ : ]);
if let error = error
{
// Handle error.
print("[GDPR] ERROR while present \(error)")
} else if userPrefersAdFree
{
// User prefers to use a paid version of the app.
} else
{
ALPrivacySettings.setHasUserConsent(true)
// Check the user's consent choice.
let status = PACConsentInformation.sharedInstance.consentStatus
if status == PACConsentStatus.personalized
{
print("[GDPR] User selected personalized")
user_info().set(key: user.gdpr_nonPersonalized, value: false)
PACConsentInformation.sharedInstance.consentStatus = .personalized
}else
if status == PACConsentStatus.nonPersonalized
{
print("[GDPR] User selected none-personalized")
user_info().set(key: user.gdpr_nonPersonalized, value: true)
PACConsentInformation.sharedInstance.consentStatus = .nonPersonalized
}else
{
}
}
}
}
}
}
这是正常的吗?什么是 GDPR 同意对话框的展示!
解决方案
仅在以下情况为真时显示同意书
requestLocationInEEAOrUnknown
推荐阅读
- c++ - 在 C++ 中制作方形图案
- php - laravel 8 API:上传多张图片并用邮递员存储
- tensorflow - Keras:回调中的 tf.cond 以增加 KL_loss (VAE) 的损失权重
- java - 如何写子工厂链接到他们的总工厂(避免这些子工厂链接到另一个工厂)?
- javascript - 如何将 C# UWP 应用程序的非 UI 部分转换为 JavaScript?
- javascript - 有输入图像字段,没有任何输入图像
- python - scipy.special.cython_special.eval_genleguerre 的错误评估
- flutter - 将此png保存到颤振的电话画廊
- telegram - Telegram issue:需要进入源频道才能发布到目标频道
- java - 在 RecyclerView 中滑动时不显示 Drawable