我在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
关于ios - 每次回到欧盟,都会弹出Admob GDPR同意对话框吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53727335/