Play interstitial ad every 3rd game

2019-09-06 15:29发布

问题:

I'm using the HeyZap mediation SDK. I have all the mediation set up perfectly fine, but I would like for the interstitial ad to show every 3rd game.

I've tried some solutions here on Stack Overflow but they apply to AdMob.

Right now, I have:

-(void) GameOver {
  ....
  [HZInterstitialAd show];
}

How do I achieve this?

回答1:

keep a counter of the number of games played and then only show it if

static int count = 0;
-(void) GameOver {
  if(count != 0 && count % 3 == 0)
    [HZInterstitialAd show];

  count++;
}