【发布时间】:2020-12-05 18:22:55
【问题描述】:
由于某种原因,当我尝试加载 GDPR 同意书时,我不断收到错误消息:
错误:应用名称无效。
它发生在这里:
form.load { [weak self](_ error: Error?) -> Void in
print("Load complete.")
if let error = error {
// *** HERE IS THE ERROR ***
print("Error loading form: \(error.localizedDescription)")
return
}
当我对invalid app name 进行全局搜索时,我会被带到consentform.html 文件:
// Set app name.
var appName = formInfo['app_name'] || '';
if (appName.length <= 0) {
formLoadCompleted('Error: invalid app name.');
}
这告诉了googleservice-plist 或我的info.plist 的一些值,或者其他没有被正确读取的值,但我不知道要查看哪个值。
在我的info.plist 中,我正确设置了GADApplicationIdentifier:
为什么我的应用名称显示为 nil?
PACConsentInformation.sharedInstance.debugGeography = .EEA
PACConsentInformation
.sharedInstance
.requestConsentInfoUpdate(forPublisherIdentifiers: ["pub-MY_PublisherID"]) { [weak self](error) in
if let error = error { return }
PACConsentInformation.sharedInstance.isRequestLocationInEEAOrUnknown {
if PACConsentInformation.sharedInstance.consentStatus == PACConsentStatus.unknown {
guard let privacyUrl = URL(string: "My_Privacy_URL"),
let form = PACConsentForm(applicationPrivacyPolicyURL: privacyUrl) else {
return
}
form.shouldOfferPersonalizedAds = true
form.shouldOfferNonPersonalizedAds = true
form.shouldOfferAdFree = true
form.load { [weak self](_ error: Error?) -> Void in
print("Load complete.")
if let error = error {
// *** HERE IS THE ERROR ***
print("Error loading form: \(error.localizedDescription)")
return
}
// ...
}
return
}
}
【问题讨论】:
标签: ios swift gdprconsentform