Search code examples
iosobjective-cfacebook-audience-network

Getting crash in Facebook Audience network while showing ad


I have integrated Facebook audience network to show ads,

Code:

if (fbInterstitialAd.isAdValid == YES) {
    [fbInterstitialAd showAdFromRootViewController:viewController];
}

but getting this crash while showing ad:

*** Terminating app due to uncaught exception 'InvalidOperationException', reason: 'showAdFromRootViewController may only be called once'

Note:


Solution

  • Currently, FBInterstitialAd is limited to show only once. If an app is trying to show it more than once, the 'InvalidOperationException' will be throwed.

    First, please add try/catch around the method '[fbInterstitialAd showAdFromRootViewController:viewController];' to avoid crash.

    Second, to verify your integration and make sure the object 'fbInterstitialAd' is not showed more than once.