0

您好,我已经在我的 ios 应用程序中实施了 Flurry 原生广告。但是它的委托方法没有被调用,所以不能显示广告。我也从这里下载了演示代码。它工作正常,但相同的实现在我的应用程序中不起作用。下面是我的代码。在这段代码中,没有调用任何委托方法。

let nativeAd = FlurryAdNative(space: "Tester")
    //    var nativeAdsWanted = 3
    //    let adFetchRetryMaximum = 10
    //    var adFetchRetryCount = 0

    // this list will hold ads that we have requested but are not ready
    var pendingAdList: [FlurryAdNative] = []
    // this list will hold our ready ads that will be dispalyed
    var nativeAdList: [FlurryAdNative] = [] {
        didSet {
            print(nativeAdList)
        }
    }
        override func viewDidLoad()
         {
                super.viewDidLoad()
                self.initFlurryAds()
         }

func initFlurryAds() {
        var newAdsList : [FlurryAdNative] = []

        //setting the ad delegate a view controller
        nativeAd?.adDelegate  = self
        nativeAd?.viewControllerForPresentation = self

        //fetching the ad from Flurry and then addding it to our list of new ads
        nativeAd?.fetchAd()
        print(nativeAd!)
        newAdsList.append(nativeAd!)
    }

func adNativeDidFetchAd(nativeAd: FlurryAdNative!){
        print("Native Ad for Space \(nativeAd.space) Received Ad with \(nativeAd.assetList.count) assets");
        nativeAdList.append(nativeAd)
    }

    // Informational callback invoked when there is an ad error
    func adNative(nativeAd: FlurryAdNative!, adError: FlurryAdError, errorDescription: NSError!){
        NSLog("Native Ad for Space \(nativeAd.space) Received Error \(adError), with description: \(errorDescription)")
    }

    func adNativeDidDismiss(_ nativeAd: FlurryAdNative!) {

    }

    func adNativeDidLogImpression(_ nativeAd: FlurryAdNative!) {

    }

    func adNativeWillPresent(_ nativeAd: FlurryAdNative!) {

    }

func adNativeExpandToggled(_ nativeAd: FlurryAdNative!) {

}
4

0 回答 0