im creating an app with ads but i have the problem that i have mutiple ads in multiple view and i just want all of that in one file this is my error and my code
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)
}
}
and 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()
}
}
 
Aucun commentaire:
Enregistrer un commentaire