gpt4 book ai didi

swift - 没有委托(delegate),didFailToReceiveAdWithError

转载 作者:行者123 更新时间:2023-11-28 13:12:24 25 4
gpt4 key购买 nike

我有这个代码:

class ViewControllergame: UIViewController, ADBannerViewDelegate {

var bannerView:ADBannerView!

override func viewDidLoad() {
super.viewDidLoad()
self.canDisplayBannerAds = true
bannerView?.delegate = self

bannerView?.hidden = true
}

func bannerViewDidLoadAd(banner: ADBannerView!) {

bannerView?.hidden = false
}



func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
return willLeave
}

func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
bannerView?.hidden = true

}

}

但它不在 didFailToReceiveAdWithError 中,当我的应用程序进入待机状态时,我收到此错误:

ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=1 "Service session terminated.

我该如何解决这个问题?

最佳答案

您似乎已经实现了这些方法,但从未调用过它们,因为您的横幅委托(delegate)未设置。如果你只使用 Storyboard

Control-Drag

从您的 ADBannerView 到横幅所在的同一个 ViewController,然后选择“委托(delegate)”Outlet。

Control-Drag

select "delegate" Outlet

关于swift - 没有委托(delegate),didFailToReceiveAdWithError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30829011/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com