iAd avec Swift dans SpriteKit

Je travaille sur une application et je voudrais inclure iAd. J'ai réussi à append des bannières publicitaires et elles fonctionnent bien. Cependant, je veux un plus grand ajout qui remplit la plupart de l'écran, mais pas en plein écran. J'ai ajouté l'adBanner en utilisant le code de la question de Benzene et la solution donnée par erdekhayser.

Apple iAd Documentation (Page 3)

Le lien que j'ai référencé ci-dessus provient de la documentation Apple et apple se réfère à l'iAd comme une publicité MREC. C'est ce que j'aimerais avoir. Je ne sais pas comment créer et en append un. J'ai essayé de resize l'adBanner mais je n'arrive toujours pas à le comprendre.

Toute aide serait appréciée

C'est le code que j'ai jusqu'ici:

import UIKit import SpriteKit import iAd import Twitter var adBannerView: ADBannerView! class GameViewController: UIViewController, ADBannerViewDelegate { var scene: GameScene! func loadAds() { adBannerView = ADBannerView(frame: CGRectZero) adBannerView.delegate = self adBannerView.hidden = true view.addSubview(adBannerView) } override func viewDidLoad() { super.viewDidLoad() // Configure the view. let skView = view as SKView skView.showsFPS = false skView.showsNodeCount = true skView.showsPhysics = false /* Sprite Kit applies additional optimizations to improve rendering performance */ skView.ignoresSiblingOrder = true /* Set the scale mode to scale to fit the window */ scene = GameScene(size: skView.bounds.size) scene.scaleMode = .AspectFill skView.presentScene(scene) //iAd loadAds() } //iAd func bannerViewWillLoadAd(banner: ADBannerView!) { println("Ad about to load") } func bannerViewDidLoadAd(banner: ADBannerView!) { adBannerView.center = CGPoint(x: adBannerView.center.x, y: view.bounds.size.height - view.bounds.size.height + adBannerView.frame.size.height / 2) adBannerView.hidden = false println("Displaying the Ad") } func bannerViewActionDidFinish(banner: ADBannerView!) { println("Close the Ad") } func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool { //pause game here println("Leave the application to the Ad") return true } func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) { //move off bounds when add didnt load adBannerView.center = CGPoint(x: adBannerView.center.x, y: view.bounds.size.height + view.bounds.size.height) println("Ad is not available") } 

Définissez canDisplayBannerAds sur true.

 override func viewDidLoad() { super.viewDidLoad() // Configure the view. let skView = self.originalContentView as! SKView loadAds() self.canDisplayBannerAds = true // <-- skView.showsFPS = false skView.showsNodeCount = true skView.showsPhysics = false /* Sprite Kit applies additional optimizations to improve rendering performance */ skView.ignoresSiblingOrder = true /* Set the scale mode to scale to fit the window */ scene = GameScene(size: skView.bounds.size) scene.scaleMode = .AspectFill skView.presentScene(scene) 

}