I'm trying to include a fullscreen iAD in an app, but the advertisement screen is showing up without the close button, the question is whether I have to do it by hand or have any hidden options for it?
I found older things about this, but I do not know if they still reflect the current reality.
This is the base of the code I'm using, but in an "empty" file.
import UIKit
import iAd
class ViewController: UIViewController, ADInterstitialAdDelegate{
var interstitialAd:ADInterstitialAd!
var interstitialAdView: UIView = UIView()
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func chamarIAd(sender: AnyObject) {
loadInterstitialAd()
}
func loadInterstitialAd() {
println("loadInterstitialAd")
interstitialAd = ADInterstitialAd()
interstitialAd.delegate = self
}
func interstitialAdWillLoad(interstitialAd: ADInterstitialAd!) {
println("interstitialAdWillLoad")
}
func interstitialAdDidLoad(interstitialAd: ADInterstitialAd!) {
println("interstitialAdDidLoad")
interstitialAdView = UIView()
interstitialAdView.frame = self.view.bounds
view.addSubview(interstitialAdView)
interstitialAd.presentInView(interstitialAdView)
UIViewController.prepareInterstitialAds()
}
func interstitialAdActionDidFinish(interstitialAd: ADInterstitialAd!) {
println("interstitialAdActionDidFinish")
interstitialAdView.removeFromSuperview()
}
func interstitialAdActionShouldBegin(interstitialAd: ADInterstitialAd!, willLeaveApplication willLeave: Bool) -> Bool {
println("interstitialAdActionShouldBegin")
return true
}
func interstitialAd(interstitialAd: ADInterstitialAd!, didFailWithError error: NSError!) {
println("interstitialAd")
}
func interstitialAdDidUnload(interstitialAd: ADInterstitialAd!) {
println("interstitialAdDidUnload")
interstitialAdView.removeFromSuperview()
}
}