Swift iAd - 超过10个ADBannerView警告实例和CGAffineTransformInvert:奇异矩阵输出
所以我试图在我的应用程序中设置一个简单的iAd横幅,但我在输出中得到这两个警告:
WARNING: More than 10 instances of ADBannerView or ADInterstitialView currently exist. This is a misuse of the iAd API, and ad performance will suffer as a result. This message is printed only once.
和
<Error>: CGAffineTransformInvert: singular matrix.
这是我用来实现我的ADBannerView
:
var adBannerView = ADBannerView()func loadAds() { adBannerView = ADBannerView(frame: CGRect.zeroRect) adBannerView.center = CGPoint(x: adBannerView.center.x, y: view.bounds.size.height - adBannerView.frame.size.height / 2) adBannerView.delegate = self adBannerView.hidden = true view.addSubview(adBannerView)}//BannerView did load adfunc bannerViewDidLoadAd(banner: ADBannerView!) { adBannerView.hidden = false}//BannerView failed to loadfunc bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) { adBannerView.hidden = true}override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. loadAds() //(rest of the code is from here onwards)
我试着添加这个来阻止第一个错误:(没有用)
//BannerView will disappearoverride func viewWillDisappear(animated: Bool) { adBannerView.removeFromSuperview() adBannerView.delegate = nil}
猛跑小猪