Search code examples
iosobjective-cxcodeadsrevmob

Revmob ad only showing up one time


This is my code, used to show an ad every 3 times the user performs an action:

if ([[NSUserDefaults standardUserDefaults] integerForKey:@"showAd"] % 3 == 0) {
 [RevMobAds startSessionWithAppID:@ID
                  withSuccessHandler:^{
                      [[RevMobAds session] showFullscreen];
                  } andFailHandler:^(NSError *error) {
                  }];
}

My problem is that the first time the ad shows up properly, as I can see in Xcode output

Starting RevMobAds
Initializing Fullscreen
Ad received: (200) - (null)

but then, everytime the ad is supposed to show (every 3 actions), I see

Testing mode off
Parallax effect disabled

and the ads doesn't show up.

I tried to set my testing mode to ON, but it doesn't change anything.

Is Revmob supposed to show an ad only ONCE at every session?


Solution

  • The problem is that you're using StartSession completion block to call the ad, but its withSuccessHandler is only called once, since you can only start RevMob's session once.

    I suggest you call the StartSession method as soon as your app starts and turn a boolean true on the withSuccessHandler.

    Then, every time you want to show an ad, check if it's true (this is just to make sure the SDK has been initialized) and use [[RevMobAds session] showFullscreen];.