I'm implementing banner ads in my game. With the help of @erdekhayser the banner was displayed successfully. But when I tap on the banner, the game won't pause. The code looks like this:
import UIKit
import SpriteKit
import iAd
import Foundation
class GameViewController: UIViewController, ADBannerViewDelegate{
var gameScene = GameScene()
var adBannerView = ADBannerView(frame: CGRect.zeroRect)
func loadAds() {
adBannerView.center = CGPoint(x: adBannerView.center.x, y: view.bounds.size.height - adBannerView.frame.size.height / 2)
adBannerView.delegate = self
view.addSubview(adBannerView)
}
//iAd bannerView
func bannerViewWillLoadAd(banner: ADBannerView!) {
}
func bannerViewDidLoadAd(banner: ADBannerView!){
loadAds()
println("1")
adBannerView.hidden = false //now show banner as ad is loaded
}
func bannerViewActionDidFinish(banner: ADBannerView!) {
println("2")
}
func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
//Tap to view the ad
gameScene.paused = true
println("3")
return true
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
adBannerView.hidden = true
println("44444")
}
// iAd stopped here ///////////
}
Anyone helps me figure it out?