Here's the problem:
Troubleshooting Steps:
I have already:
Current Status:
let requestParameter = UMPRequestParameters()
let debugSetting = UMPDebugSettings()
debugSetting.geography = .EEA
debugSetting.testDeviceIdentifiers = ["4902DF8E-CAD4-4EF1-B061-4607F4A2ACBF"] //"64B1E738-5465-4AD6-91A5-993548592D7D"]
requestParameter.debugSettings = debugSetting
// Request an update for the consent information.
UMPConsentInformation.sharedInstance.requestConsentInfoUpdate(with: requestParameter) {
[weak self] requestConsentError in
guard let self else { return }
if let consentError = requestConsentError {
// Consent gathering failed.
return print("Error: \(consentError.localizedDescription)")
}
UMPConsentForm.loadAndPresentIfRequired(from: self) {
[weak self] loadAndPresentError in
guard let self else { return }
if let consentError = loadAndPresentError {
// Consent gathering failed.
return print("Error: \(consentError.localizedDescription)")
}
// else{
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0){
if UMPConsentInformation.sharedInstance.canRequestAds{
self.startMobileSdk()
}
else{
self.loadNonPersonalizedAds()
}
}
}
// TODO: Load and present the consent form.
}
// DispatchQueue.main.asyncAfter(deadline: .now() + 4.0){
if UMPConsentInformation.sharedInstance.consentStatus == .obtained {
if UMPConsentInformation.sharedInstance.canRequestAds{
self.startMobileSdk()
}
else{
self.loadNonPersonalizedAds()
}
}
private func loadNonPersonalizedAds() {
DispatchQueue.main.async {
// Configure the request for non-personalized ads
let request = GADRequest()
request.requestAgent = "PubCommonID=ForAdvertisingID/IDFA;is_lat=0"
// Load the banner view with non-personalized ads
self.bannerView.load(request)
}
}
private func startMobileSdk(){
DispatchQueue.main.async {
guard !self .isMobileAdStartCalled else { return }
self.isMobileAdStartCalled = true
// let request: GADRequest = GADRequest()
// self.bannerView.load(request)
let request = GADRequest()
let extras = GADExtras()
extras.additionalParameters = ["tag_for_child_directed_treatment": "false"]
request.register(extras)
self.bannerView.load(request)
}
}
![]() |
Mobile Ads SDK Team |