iPhone上的网络成瘾广告?

iPhone上的网络成瘾广告?,iphone,ipad,iad,interstitial,Iphone,Ipad,Iad,Interstitial,我和我的开发人员此前曾试图在iPhone和iPad上加载插页广告,但只在iPad上成功 在我们的测试中,我们发现iPhone不支持中间层,但自从iOS7发布以来,一些人说这是可能的 然而,我找不到关于这个的任何像样的文档。这个堆栈问题让我再次感到疑惑 那么,iPhone上是否可以使用iAd进行全屏间隙广告呢?我也一直在等待iAd发布iPhone间隙广告。我终于在我的一个应用程序中实现了它,它正在运行并显示测试广告。该应用程序目前正在审查中,一旦获得批准,我将更新我的答案,我可以测试是否有任何实际

我和我的开发人员此前曾试图在iPhone和iPad上加载插页广告,但只在iPad上成功

在我们的测试中,我们发现iPhone不支持中间层,但自从iOS7发布以来,一些人说这是可能的

然而,我找不到关于这个的任何像样的文档。这个堆栈问题让我再次感到疑惑


那么,iPhone上是否可以使用iAd进行全屏间隙广告呢?

我也一直在等待iAd发布iPhone间隙广告。我终于在我的一个应用程序中实现了它,它正在运行并显示测试广告。该应用程序目前正在审查中,一旦获得批准,我将更新我的答案,我可以测试是否有任何实际的广告正在提供。同时,以下是我用来实现iAd间隙的代码:

ViewController.h

@interface ViewController : UIViewController <ADInterstitialAdDelegate> {
    ADInterstitialAd *interstitial;
    BOOL requestingAd;
}

-(void)showFullScreenAd;
在用户执行某个操作后,我只需调用
-(void)showFullScreenAd
。有关更多信息,请参阅

编辑:01/03/14 应用程序更新已获得批准,并已上线12小时。到目前为止,我还没有收到任何间隙IAD。这可能是由于iPhone上缺少间隙广告的库存,也可能与我在iTunes Connect的iAd模块中收到的以下消息有关。消息是

当您提交应用程序[应用程序名称]以供批准时,iAd还将对其进行审查,以便在应用程序网络上使用,以确定其是否适合接收来自iAd广告商的广告。一旦你的应用程序获得批准,你就可以开始为在你的应用程序中运行的广告赚取收入了

我以前从未收到过此消息,我通常会在应用商店发布更新后立即收到“你的应用现在有资格接收广告”消息。这要么是因为我的应用程序中新实施了插入式广告,要么是苹果更新了一些iAd程序

如果我开始收到间隙IAD,我将再次更新答案。与此同时,你可以在我的应用程序上自己测试它。一旦用户在应用程序内通过Facebook共享,就会调用上述代码,并显示一条中间广告

编辑:2014年7月1日 直接联系iAd,并于今天收到回复

你好,丹尼尔, 初始填充率将反映iOS 7上最近推出的间隙。感谢您的耐心,因为我们提高了广告服务。 如果您还没有,我们建议您在应用程序中集成标准的纵向和横向iAd横幅,以利用所有可用类型的广告库存。 最后,作为将来的参考,当你提交你的应用程序以供批准时,它也将由iAd审查,以确定它是否适合接收来自iAd广告商的广告。因此,您的新iAd应用程序可能需要几天时间才能开始接收广告印象。 顺致敬意,  iAd应用程序网络支持


因此,iPhone的间隙IAD确实适用于iOS 7.0及以上版本,但目前填充率较低。

我最初的答案已经开始过时,因此这里有一个较新的Swift实现:

此实现使用了
手册
aInterstitualPresentationPolicy
,因此我们可以按自己的时间间隔展示间隙。当手动显示间隙时,它不会使用自己的关闭按钮自行关闭。因此,我所做的是创建一个
UIView
来表示中间层,并使用中间层的委托方法来取消
UIView
。测试时仍会出现与从iAd网络接收广告不一致的情况。有时你收到一个广告,有时它无法加载,这使我们可以要求一个新的广告,有时什么也没有发生。这似乎就是iAd间质的本质

import UIKit
import iAd // Import iAd

class ViewController: UIViewController, ADInterstitialAdDelegate { // Include the delegate

    var iAdInterstitial = ADInterstitialAd() // Our ad
    var iAdInterstitialView = UIView() // View to present our ad in
    var adLoaded = false // Bool to keep track if an ad is loaded or not

    override func viewDidLoad() {
        super.viewDidLoad()
        setupAd()
    }

    func setupAd() {
        // Set presentation to manual so we can choose when to present the interstitial
        // Setting this will also fetch an interstitial ad for us
        self.interstitialPresentationPolicy = ADInterstitialPresentationPolicy.Manual
        iAdInterstitial.delegate = self // Set the delegate

        // Make our view the same size as the view we will be presenting in
        iAdInterstitialView.frame = self.view.bounds
    }

    func requestNewAd() {
        // This will fetch an ad for us
        ViewController.prepareInterstitialAds()
        println("Requesting new ad")
    }

    @IBAction func presentAdButton(sender: AnyObject) {
        if (adLoaded) {
            // We have an ad that is loaded so lets present it
            self.view.addSubview(iAdInterstitialView)
            iAdInterstitial.presentInView(iAdInterstitialView)
        }
        else {
            // No ad has been loaded
            println("Ad not loaded")
        }
    }

    func interstitialAdDidUnload(interstitialAd: ADInterstitialAd!) {
        // Kinda works as expected
        // Sometimes is called prematurely
        // Sometimes takes minutes after ad is dismissed to be called
        println("interstitialAdDidUnload")

        // Get new ad
        adLoaded = false
        iAdInterstitialView.removeFromSuperview()
        requestNewAd()
    }

    func interstitialAd(interstitialAd: ADInterstitialAd!, didFailWithError error: NSError!) {
        // Failed to load ad so lets try again
        println("didFailWithError: \(error)")
        requestNewAd()
    }

    func interstitialAdWillLoad(interstitialAd: ADInterstitialAd!) {
        // There is an ad and it has begun to download
        println("interstitialAdWillLoad")
    }

    func interstitialAdDidLoad(interstitialAd: ADInterstitialAd!) {
        // We got an ad
        println("interstitialAdDidLoad")
        adLoaded = true
    }

    func interstitialAdActionShouldBegin(interstitialAd: ADInterstitialAd!, willLeaveApplication willLeave: Bool) -> Bool {
        println("interstitialAdActionShouldBegin")
        return true;
    }

    func interstitialAdActionDidFinish(interstitialAd: ADInterstitialAd!) {
        // Done with this ad. Lets get a new one
        println("interstitialAdActionDidFinish")
        iAdInterstitialView.removeFromSuperview()
        adLoaded = false
        requestNewAd()
    }

代码是否仅为iOS7?期待您的应用上线后看到您的更新。@Buckers是的,新添加的iAd需要iOS 7.0或以上版本@DanielStormApps这几乎可以正常工作,只需
[interstitial presentFromViewController:self]自iOS7以来已弃用。使用
[间隙显示视图:self.view]
instead其他人在调用广告完成的代理时会出现黑屏吗?@DanielStormApps谢谢,但这并不能解决问题,只是一个解决办法。他们还不支持iAds,但许多其他网络,如Admob、Amazon和Chartboost。看一看,在android上使用它,他们平均支付7-9美元的eCPM,并且支持插入式和插入式视频!我使用上面的代码,但总是收到错误消息:错误域=错误域代码=3“操作无法完成。Ad inventory unavailable”UserInfo=0x7fe5584be760{ADInternalErrorCode=3,NSLocalizedFailureReason=Ad inventory unavailable,ADInternalErrorDomain=ADErrorDomain}正在请求未加载新广告--------我将//开发者//填充率设置为始终100%
import UIKit
import iAd // Import iAd

class ViewController: UIViewController, ADInterstitialAdDelegate { // Include the delegate

    var iAdInterstitial = ADInterstitialAd() // Our ad
    var iAdInterstitialView = UIView() // View to present our ad in
    var adLoaded = false // Bool to keep track if an ad is loaded or not

    override func viewDidLoad() {
        super.viewDidLoad()
        setupAd()
    }

    func setupAd() {
        // Set presentation to manual so we can choose when to present the interstitial
        // Setting this will also fetch an interstitial ad for us
        self.interstitialPresentationPolicy = ADInterstitialPresentationPolicy.Manual
        iAdInterstitial.delegate = self // Set the delegate

        // Make our view the same size as the view we will be presenting in
        iAdInterstitialView.frame = self.view.bounds
    }

    func requestNewAd() {
        // This will fetch an ad for us
        ViewController.prepareInterstitialAds()
        println("Requesting new ad")
    }

    @IBAction func presentAdButton(sender: AnyObject) {
        if (adLoaded) {
            // We have an ad that is loaded so lets present it
            self.view.addSubview(iAdInterstitialView)
            iAdInterstitial.presentInView(iAdInterstitialView)
        }
        else {
            // No ad has been loaded
            println("Ad not loaded")
        }
    }

    func interstitialAdDidUnload(interstitialAd: ADInterstitialAd!) {
        // Kinda works as expected
        // Sometimes is called prematurely
        // Sometimes takes minutes after ad is dismissed to be called
        println("interstitialAdDidUnload")

        // Get new ad
        adLoaded = false
        iAdInterstitialView.removeFromSuperview()
        requestNewAd()
    }

    func interstitialAd(interstitialAd: ADInterstitialAd!, didFailWithError error: NSError!) {
        // Failed to load ad so lets try again
        println("didFailWithError: \(error)")
        requestNewAd()
    }

    func interstitialAdWillLoad(interstitialAd: ADInterstitialAd!) {
        // There is an ad and it has begun to download
        println("interstitialAdWillLoad")
    }

    func interstitialAdDidLoad(interstitialAd: ADInterstitialAd!) {
        // We got an ad
        println("interstitialAdDidLoad")
        adLoaded = true
    }

    func interstitialAdActionShouldBegin(interstitialAd: ADInterstitialAd!, willLeaveApplication willLeave: Bool) -> Bool {
        println("interstitialAdActionShouldBegin")
        return true;
    }

    func interstitialAdActionDidFinish(interstitialAd: ADInterstitialAd!) {
        // Done with this ad. Lets get a new one
        println("interstitialAdActionDidFinish")
        iAdInterstitialView.removeFromSuperview()
        adLoaded = false
        requestNewAd()
    }