16

My developer and I had previously tried to get interstitial adverts loading on iPhone and iPad, however only managed to get this working on iPad.

During our testing we discovered that interstitials weren't supported on iPhone, but since the release of iOS7 some people now say this is possible.

However I can't find any decent documentation on this. This Stack question has got me wondering again though iAd & Admob Interstitial Integration on iPhone

So, are full screen interstitials possible on iPhone using iAds?

Community
  • 1
  • 1
pixelkicks
  • 866
  • 2
  • 11
  • 23
  • They don´t support iAds yet, but many other networks like Admob,Amazon and Chartboost. Take a look at http://appodeal.com/+signup .Using it on android, they pay an eCPM of 7-9$ in average and support interstitials and interstitial video! – Marian Klühspies May 09 '15 at 10:09

2 Answers2

20

I've also been waiting for interstitial ads for iPhone from iAd. I finally have it implemented into one of my apps and it is running and showing test ads just fine. The app is currently in review and I will update my answer once it is approved and I can test if any actual ads are being served. In the meantime, here is the code I used to implement iAd interstitials:

ViewController.h

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

-(void)showFullScreenAd;

ViewController.m

-(void)viewDidLoad {
    requestingAd = NO;
}

// Interstitial iAd
-(void)showFullScreenAd {
    // Check if already requesting ad
    if (requestingAd == NO) {
        [ADInterstitialAd release];
        interstitial = [[ADInterstitialAd alloc] init];
        interstitial.delegate = self;
        self.interstitialPresentationPolicy = ADInterstitialPresentationPolicyManual;
        [self requestInterstitialAdPresentation];
        NSLog(@"interstitialAdREQUEST");
        requestingAd = YES;
    }
}

-(void)interstitialAd:(ADInterstitialAd *)interstitialAd didFailWithError:(NSError *)error {
    interstitial = nil;
    [interstitialAd release];
    [ADInterstitialAd release];
    requestingAd = NO;
    NSLog(@"interstitialAd didFailWithERROR");
    NSLog(@"%@", error);
}

-(void)interstitialAdDidLoad:(ADInterstitialAd *)interstitialAd {
    NSLog(@"interstitialAdDidLOAD");
    if (interstitialAd != nil && interstitial != nil && requestingAd == YES) {
        [interstitial presentFromViewController:self];
        NSLog(@"interstitialAdDidPRESENT");
    }
}

-(void)interstitialAdDidUnload:(ADInterstitialAd *)interstitialAd {
    interstitial = nil;
    [interstitialAd release];
    [ADInterstitialAd release];
    requestingAd = NO;
    NSLog(@"interstitialAdDidUNLOAD");
}

-(void)interstitialAdActionDidFinish:(ADInterstitialAd *)interstitialAd {
    interstitial = nil;
    [interstitialAd release];
    [ADInterstitialAd release];
    requestingAd = NO;
    NSLog(@"interstitialAdDidFINISH");
}

I just call -(void)showFullScreenAd after the user performs a certain action. For more information refer to UIViewController iAd Additions Reference

EDIT: 01/03/14 The app update was approved and has been live for 12 hours now. I still have not received any interstitial iAds as of this moment. It may be due to the lack of inventory for interstitial ads on iPhone or it may have something to do with the following message I've received in my iAd module on iTunes Connect. The message reads

When you submit your app, [app name], for approval, it will also be reviewed by iAd for use on the App Network to determine its appropriateness for receiving ads from iAd advertisers. Once your app is approved, you will be ready to start earning revenue for ads that run in your app.

I've never received this message before, I usually receive the "Your app is now eligible to receive ads" message as soon as the update is released in the App Store. It's either because of the new implementation of interstitial ads in my app or Apple has updated some of its iAd procedures.

Will update answer again if and when I do start receiving interstitial iAds. In the meantime you may test it yourself on my app +Quotes. The above code is invoked and an interstitial ad should show once a user shares via Facebook within the app.

EDIT: 01/07/14 Contacted iAd directly and received a response today

Hello Daniel, Initial fill rates will reflect the recent launch of interstitials on iOS 7. Thank you for your patience as we ramp up ad serving. If you haven't already, we recommend you integrate standard portrait and landscape iAd banners in your app to take advantage of all available types of advertising inventory. Finally, for future reference, when you submit your app for approval, it will also be reviewed by iAd to determine its appropriateness for receiving ads from iAd advertisers. Therefore, it may take a few days for your new iAd enabled app to begin receiving ad impressions. Best Regards,  iAd App Network Support

So, interstitial iAds for iPhone do work with iOS 7.0 and above but have a low fill rate currently.

Daniel Storm
  • 18,301
  • 9
  • 84
  • 152
  • Is the code iOS7 only? Look forward to seeing your update once your app goes live. – pixelkicks Dec 31 '13 at 17:58
  • @Buckers Yes, the new iAd additions require iOS 7.0 or above noted here [UIViewController iAd Additions Reference](https://developer.apple.com/library/ios/documentation/iAd/Reference/UIViewController_iAd_Additions/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/requestInterstitialAdPresentation) – Daniel Storm Jan 03 '14 at 14:44
  • 2
    @DanielStormApps this works almost, just `[interstitial presentFromViewController:self];` is deprecated since iOS7. Use `[interstitial presentInView:self.view];`instead – zero3nna Mar 12 '14 at 17:22
  • 2
    anyone else have a black screen when the ad finished delegate is called? – 4GetFullOf Nov 19 '14 at 18:40
  • @DanielStormApps thanks but that doesn't resolve the issue just a work around – 4GetFullOf Nov 20 '14 at 15:07
  • @DanielStormApps: Is your app Live? can you share your App name? – Vignesh Jan 13 '15 at 14:17
  • @Vignesh there's a link in my answer to the application I originality utilized this code in. I have since removed the iAd interstitials and instead have implemented AdMob's interstitials due to the low fill rate iAd was providing at launch. – Daniel Storm Jan 13 '15 at 15:04
  • @DanielStormApps: Yes. I had a glance on your App, Quotes+. Daniel, I just want to tell u that, my app was just rejected from the app store, because of iAds. The review said, You have registered for iAds, but your App is not receiving iAds/there is no provision for it. Would you mind helping me to sort it out? Can you share your code. Or atleast the iAd part of it. – Vignesh Jan 14 '15 at 05:03
  • @Vignesh I'd suggest starting your own question or searching on StackOverflow for similar questions, there are plenty. There's many variables as to why they may have rejected your app beyond just the code, ie. using iTunes screenshots that show empty iAd banners. More details are needed and the question you are asking is not inline with this questions topic. If you do decide to post a detailed question tag me in it and I will see if I can offer any insight. – Daniel Storm Jan 14 '15 at 15:01
  • @DanielStormApps, I face that `requestInterstitialAdPresentation` always gives FALSE. Is there any issue why I get FALSE every time? I have used the same code you provide and used `showFullscreenAd` block. – Paresh Thakor Jan 26 '15 at 17:44
  • Daniel, you mention in the comments that you removed iAd interstitials due to low fill rate, can I ask when you removed them? i.e. when you were still seeing low fill rates? I want to use them myself but the only commentary I can find is about low fill rates. Any additional info also welcomed, e.g. did you get any at all? how may were you expecting or requesting, etc. Thanks – Rory O'Bryan Jan 27 '15 at 10:51
  • @RoryO'Bryan, I removed them shortly after providing this answer, so around Feb '14. The fill rate at that time was so low it's not even worth mentioning. AdMob's inventory was providing close to a 90% fill rate at the time in comparison, so the switch was a no-brainer for me. I can not speak for iAd's interstitial fill rate as of now. I do not have it implemented in any of my apps so it's fill rate may have increased since then, which I would assume. Implement it and fall back on AdMob if there is no ad available and see for yourself. – Daniel Storm Jan 28 '15 at 10:10
  • @DanielStorm Hi Daniel, I implemented this but its not working in horizontal but apart from that it works fine in portrait :/ The error I get in landscape mode: `Code=3 "The operation couldn’t be completed. Ad inventory unavailable"` Any Ideas? –  Nov 11 '15 at 18:02
2

My original answer is starting to age away so here's a newer Swift implementation:

This implementation uses a Manual ADInterstitialPresentationPolicy so we can present our interstitials at our own intervals. When manually presenting your interstitial it does not load with its own close button to dismiss itself. So, what I've done is created a UIView to present the interstitial in and used the interstitial's delegate methods to dismiss the UIView. The inconsistency with receiving an ad from the iAd network still arises when testing. Sometimes you receive an ad, sometimes it fails to load which allows us to request a new ad, and sometimes nothing happens at all. This just seems to be the nature of iAd's interstitials.

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()
    }
Daniel Storm
  • 18,301
  • 9
  • 84
  • 152
  • i use above code but always got error msg didFailWithError: Error Domain=ADErrorDomain Code=3 "The operation couldn’t be completed. Ad inventory unavailable" UserInfo=0x7fe5584be760 {ADInternalErrorCode=3, NSLocalizedFailureReason=Ad inventory unavailable, ADInternalErrorDomain=ADErrorDomain} Requesting new ad Ad not loaded-------- i enable setting//developer//fill rate to always 100% – amit gupta Dec 21 '15 at 10:56