Swift iOS:iAd没有填充

时间:2015-04-16 15:33:38

标签: swift iad

我正在迅速构建一个iPhone应用程序,而且我还有一个我试图展示的矩形横幅广告。我已经为iAd正确设置了我的Dev帐户,但该广告并未在应用中填充。我得到 测试广告,但不是我期望的广告。

以下是带广告的控制器代码和屏幕截图:

//
//  AdViewController.swift
//
//  Created by Kevin Whitaker on 3/26/15.
//

import UIKit
import iAd

class AdViewController: UIViewController, ADBannerViewDelegate {

    @IBOutlet weak var AdView: ADBannerView!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        self.canDisplayBannerAds = true
        AdView = ADBannerView(adType: ADAdType.MediumRectangle)
        AdView?.delegate = self
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    override func prefersStatusBarHidden() -> Bool {
        return true
    }

    override func shouldAutorotate() -> Bool {
        return false
    }

    // MARK: - Ads
    func bannerViewDidLoadAd(banner: ADBannerView!) {
        self.view.addSubview(banner)
    }

    func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
        banner.removeFromSuperview()
    }

}

Screenshot of the blank ad

1 个答案:

答案 0 :(得分:1)

正如@KnightOfDragon在评论中提到的the medium rectangle ad is only available for applications running on iPad。 您正在寻找的是interstitial ad。这些是您在其他iPhone应用中看到的全屏广告。