iosswiftfirebasegoogle-ads-apigoogle-mobile-ads

Can't find GADUnifiedNativeAdView in GoogleMobileAds


In podfile.lock I have:

  • Google-Mobile-Ads-SDK (8.7.0):
    • GoogleAppMeasurement (< 9.0, >= 7.0)
    • GoogleUserMessagingPlatform (>= 1.1)

This code works fine, so the SDK installed successfully.

import GoogleMobileAds

 let options = GADMultipleAdsAdLoaderOptions()
 options.numberOfAds = 5
 adLoader = GADAdLoader(adUnitID: adUnitID, rootViewController: requester, adTypes: [.native], options: [options])
 adLoader.delegate = self

But I can display the received GADNativeAd, because views are unaccessible.

import UIKit
import GoogleMobileAds

class FeedAdTVC: UITableViewCell {

    func setup(with: GADNativeAd) {
        let templateView = GADUnifiedNativeAdView()
    }
}

I got: Cannot find 'GADUnifiedNativeAdView' in scope


Solution

  • It seems that GADUnifiedNativeAdView has been removed in version 8 of Google Ad Manager, and it seems to be replaced with GADNativeAdView.

    Check the migration guide here.