Ios 多个IAD的1个文件出错

Ios 多个IAD的1个文件出错,ios,iphone,xcode,swift,iad,Ios,Iphone,Xcode,Swift,Iad,我正在创建一个带有广告的应用程序,但我有一个问题,我在多个视图中有多个广告,我只希望所有这些都在一个文件中这是我的错误和代码 iAd.swift: import iAd import Foundation class iAd: ADBannerView, ADBannerViewDelegate { func bannerViewWillLoadAd(banner: ADBannerView!) { } func bannerViewDidLoadAd(banner

我正在创建一个带有广告的应用程序,但我有一个问题,我在多个视图中有多个广告,我只希望所有这些都在一个文件中这是我的错误和代码

iAd.swift:

 import iAd
 import Foundation

class iAd: ADBannerView, ADBannerViewDelegate {
    func bannerViewWillLoadAd(banner: ADBannerView!) {
    }
    func bannerViewDidLoadAd(banner: ADBannerView!) {
    }
    func bannerViewActionDidFinish(banner: ADBannerView!) {
    }
    func bannerViewActionShouldBegin(banner: ADBannerView!,     willLeaveApplication willLeave: Bool) -> Bool {
        return true
    }
    func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError       error: NSError!) {
        println(error)
    }
}
和view controller.swift:

import UIKit
import iAd

class ViewController: UIViewController {

    @IBOutlet var adBannerView: iAd!
    override func viewDidLoad() {
        super.viewDidLoad()
        self.canDisplayBannerAds = true
        self.adBannerView.delegate = iAd() as ADBannerViewDelegate
        self.adBannerView.hidden = false
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}
错误地

 2015-02-26 09:57:14.605 iAd[671:11279] [AppDeveloper] ADBannerView: 
 Unhandled error (no delegate or delegate does not implement 
 didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=7 "The 
 operation couldn’t be completed. Ad was unloaded from this banner" 
 UserInfo=0x7fda6358c770 {ADInternalErrorCode=7, NSLocalizedFailureReason=Ad
 was unloaded from this banner, ADInternalErrorDomain=ADErrorDomain}