Reputation: 1174
I am using google advance native Ad. My Ad is display successfully on simulator and device when I run from Xcode, but when my app is live then one day Ad display on all device then another day Ad is not display in any one device whats problem in my code please help me.
Mainview is GADUnifiedNativeAdView
cell.Mainview.nativeAd = nativeAd
cell.Mainview.mediaView?.mediaContent = nativeAd.mediaContent
(cell.Mainview.iconView as! UIImageView).image = (nativeAd.icon)?.image
cell.Mainview.iconView?.isHidden = nativeAd.icon == nil
(cell.Mainview.bodyView as! UILabel).text = nativeAd.body
cell.Mainview.bodyView?.isHidden = nativeAd.body == nil
(cell.Mainview.headlineView as! UILabel).text = nativeAd.headline
(cell.Mainview.callToActionView as! UIButton).setTitle(
nativeAd.callToAction?.uppercased(), for: UIControl.State.normal)
cell.Mainview.callToActionView?.isHidden = nativeAd.callToAction == nil
cell.Mainview.callToActionView?.isUserInteractionEnabled = false
Note : I also applied all privacy and policy of Ad.
Upvotes: 3
Views: 1248
Reputation: 1380
I don't think this is a code related issue. I think an ad is not loaded from GMA SDK. Implementing a native ad does not necessarily mean an ad will always be available for display. Are you sure that GADUnifiedNativeAdLoaderDelegate
's
func adLoader(_ adLoader: GADAdLoader, didReceive nativeAd: GADUnifiedNativeAd)
function is being called when the ad is not displayed?
My suggestion would be to add a firebase event or log to GADAdLoaderDelegate
's
func adLoader(_ adLoader: GADAdLoader, didFailToReceiveAdWithError error: GADRequestError)
function to see if some of your adLoader.load(GADRequest())
functions are failing or not. You might be getting "Request Error: No ad to show" request error.
Upvotes: 2