So I am trying to set up a simple iAd banner in my application but I am getting these two warnings in the output:
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.
and
<Error>: CGAffineTransformInvert: singular matrix.
This is what I am using to implement my 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 ad
func bannerViewDidLoadAd(banner: ADBannerView!) {
adBannerView.hidden = false
}
//BannerView failed to load
func 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)
I tried adding this to stop the first error: (hasn't worked)
//BannerView will disappear
override func viewWillDisappear(animated: Bool) {
adBannerView.removeFromSuperview()
adBannerView.delegate = nil
}
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…