1

I have a game showing ads through AdWhirl. Ads are only shown when the user is in the menu and are periodically refreshed with:

        [adView requestFreshAd];

My problem is that the refresh and the associated networking will take place when the user is playing (i.e. not when the user is in the menu), which generates lag and is very annoying for a few seconds.

To avoid this, I have prohibited refreshes from being triggered outside of the menu. (basically using a boolean canUpdateAd):

-(void)updateAd{
    if(adView!=nil){
        if(canUpdateiAd){
            NSLog(@"requesting fresh ad");
            [adView requestFreshAd];
            [self performSelector:@selector(updateAd) withObject:nil afterDelay:refreshRate];
        }
        else {
         [self performSelector:@selector(updateAd) withObject:nil afterDelay:4];
        }
    }
}

But even so, refreshes sometimes start while in the menu, just before the user starts a new game. Is there anyway to "pause" or "slow-down" an ad refresh to avoid having lags?

Thank you!

David
  • 1,898
  • 2
  • 14
  • 32
  • Where is your updateAd: method getting called in relation to your view lifecycles? Where are you setting your canUpdateiAd variable? – RajPara Mar 16 '12 at 17:49

1 Answers1

0

You can use following link : How to Integrate AdWhirl into a Cocos2D Game

http://www.raywenderlich.com/5350/how-to-integrate-adwhirl-into-a-cocos2d-game

Leo Moon85
  • 150
  • 10