Mopub Interstitial not loading

mopub
ios

#1

I am going over Fabric Mopub code example, when I run the app, even though mopub outputs:

2017-01-15 13:47:46.801224 Twit Miner[23775:6627095] MOPUB: Looking for custom event class named MPHTMLInterstitialCustomEvent.
2017-01-15 13:47:46.801321 Twit Miner[23775:6627095] MOPUB: Loading MoPub HTML interstitial
2017-01-15 13:47:46.999975 Twit Miner[23775:6627095] MOPUB: MoPub HTML interstitial did load

But I don’t see any interstitial ad being displayed. You can find my code below:

import UIKit
import MoPub

class ViewController: UIViewController
, MPInterstitialAdControllerDelegate

{
    // TODO: Replace this test id with your personal ad unit id
    var interstitial: MPInterstitialAdController =
        MPInterstitialAdController(forAdUnitId: "77ce0b65cf81438eb255695afe3b1904")

    override func viewDidLoad() {
        super.viewDidLoad()

        self.interstitial.delegate = self
        // Pre-fetch the ad up front
        self.interstitial.loadAd()
    }

    func interstitialDidLoadAd(interstitial: MPInterstitialAdController) {
        // This sample automatically shows the ad as soon as it's loaded, but
        // you can move this showFromViewController call to a time more
        // appropriate for your app.
        if (interstitial.ready) {
            interstitial.showFromViewController(self)
        }
    }
}

Even though log suggests otherwise, when I put a breakpoint, I realized that interstitialDidLoadAd method is never being called. I thought that it might be due to the ATS so I added the following keys to the info.plist:

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSAllowsArbitraryLoadsForMedia</key>
        <true/>
        <key>NSAllowsArbitraryLoadsInWebContent</key>
        <true/>
    </dict>

still no luck, can someone tell me what I am probably doing wrong?


#2

Hi @erincarikan,

Thanks for reaching out!

The logs you provided show that the ad was loaded correctly:
2017-01-15 13:47:46.801224 Twit Miner[23775:6627095] MOPUB: Looking for custom event class named MPHTMLInterstitialCustomEvent. 2017-01-15 13:47:46.801321 Twit Miner[23775:6627095] MOPUB: Loading MoPub HTML interstitial 2017-01-15 13:47:46.999975 Twit Miner[23775:6627095] MOPUB: MoPub HTML interstitial did load

However, the logs don’t show that you tried to show the interstitial. Did you follow the steps outlined here to show the ad? Steps 5 and 6 should be helpful.

If you are still having trouble, I’d recommend reviewing out self-testing documentation to ensure you are set up to start showing ads. You can feel free to reach out to our Support Team with the full logs from your testing and your ad unit ID if you need additional help. They can be reached at support@mopub.com.

Thanks!