您好我已经在我的ios应用中实施了flurry原生广告。但是没有调用其委托方法,因此无法显示广告。我还从here下载了演示代码。它的工作正常但相同的实现在我的应用程序中不起作用。以下是我的代码。在此代码中,不会调用任何委托方法。
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!) {
}