首页 文章

每5个单元格上都有iAd UICollectionView

提问于
浏览
-1

这是我第一次使用iAd并希望在UICollectionView中的每5个单元格上显示它 . 我有两个单元格正常,一个用于iAd,我已将委托连接到IAdCell并参考ADBannerViewDelegate

在viewDidLoad()中,我有self.canDisplayBannerAds = true

在UICollectionView中,我使用此代码来决定我想要返回的单元格

override func collectionView(collectionView:UICollectionView,cellForItemAtIndexPath indexPath:NSIndexPath) - > UICollectionViewCell {

let isBanner = movies[indexPath.row].TmdbId == nil
    if(isBanner){
        let cell = collectionView.dequeueReusableCellWithReuseIdentifier("iAdCell", forIndexPath: indexPath) as! IAdCell

        return cell
    }

    let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! LatestMovieTVCell

    return cell
}

细胞看起来像这样

导入UIKit导入iAd

class IAdCell:UICollectionViewCell,ADBannerViewDelegate {

@IBOutlet var IAdBanner: ADBannerView!

override func awakeFromNib() {
    super.awakeFromNib()
    IAdBanner.hidden = true
}

func bannerViewDidLoadAd(banner: ADBannerView!) {
    banner.hidden = false
}

func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
    return true
}

}

但似乎没有显示广告是空的

谢谢Bennie

1 回答

  • 3

    Apple关闭了iAd网络:

    https://developer.apple.com/support/iad/

    从2016年7月1日开始,iAd将不再可供开发者通过运行iAd销售的广告或在iAd App Network上推广其应用来赚取收入 .

    所有 iAd.framework 内容都已弃用 . 那个's why you'没有看到任何东西 .

    已实施已弃用的iAd.Framework类的应用程序不应仅因为弃用而崩溃 . 在下一次常规应用更新或提交时,您应该删除iAd框架和连接 .

相关问题