I’m following the google codelab for including native adverts in flutter for android and ios. For android it’s working correctly. However after I run the iOS app, it offers me error that the “NativeAdFactory” will not be in scope
AppDelegate.swift
import Flutter
import UIKit
import google_mobile_ads
@primary
@objc class AppDelegate: FlutterAppDelegate {
override func utility(
_ utility: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
let nativeInlineAdFactory = NativeInlineAdFactory()
FLTGoogleMobileAdsPlugin.registerNativeAdFactory(
self, factoryId: "nativeInlineAd", nativeAdFactory: nativeInlineAdFactory)
return tremendous.utility(utility, didFinishLaunchingWithOptions: launchOptions)
}
}
And Native advert manufacturing facility is in similar runner folder is as follows:
import google_mobile_ads
class NativeInlineAdFactory : FLTNativeAdFactory {
func createNativeAd(_ nativeAd: GADNativeAd,
customOptions: [AnyHashable : Any]? = nil) -> GADNativeAdView? {
let nibView = Bundle.primary.loadNibNamed("NativeInlineAdView", proprietor: nil, choices: nil)!.first
let nativeAdView = nibView as! GADNativeAdView
(nativeAdView.headlineView as! UILabel).textual content = nativeAd.headline
(nativeAdView.bodyView as! UILabel).textual content = nativeAd.physique
nativeAdView.bodyView!.isHidden = nativeAd.physique == nil
(nativeAdView.iconView as! UIImageView).picture = nativeAd.icon?.picture
nativeAdView.iconView!.isHidden = nativeAd.icon == nil
nativeAdView.callToActionView?.isUserInteractionEnabled = false
nativeAdView.nativeAd = nativeAd
return nativeAdView
}
}
How can I repair this problem?