Liftoff
Liftoff

Reputation: 25392

iAd lags when changing ads

Recently I've noticed in my game whenever iAd changes the currently displayed ad, there is about a 0.25 second lag in the game, which is just enough to be noticeable. After the ad finishes loading, there are no lag problems, but up until that point, if the user is in-game, that could hurt their experience.

Has anyone found a solution to the iAd lag problem?


My iAd Code:

- (void)bannerViewActionDidFinish:(ADBannerView *)banner
{
    //Returned from iAd
    [self resume];
}

- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
    banner.hidden = NO;

    //Hide google ad
    googleAdBanner.hidden = YES;
}

- (void)bannerView:(ADBannerView *)aBanner didFailToReceiveAdWithError:(NSError *)error{

    NSLog(@"Error: %@",error);
    aBanner.hidden = YES;

    //Show google ad
    googleAdBanner.hidden = NO;

}

- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
    [self pause];
    return YES;
}

I've also noticed that there is a lag right when I ad the banner view to the screen.

Upvotes: 0

Views: 398

Answers (1)

XeroxDucati
XeroxDucati

Reputation: 5190

Short answer: Yeah, there's a lag under heavy load, and there's nothing to be done about it.

Slightly longer version: This seems to occur when you're already close to tapping out the performance of the device, and iAd just pushes you over the top. The simplest solution is to not show ads during gameplay, but only during menu/pause states.

If you're determined to show ads during gameplay, hook up instruments to your game and see if you can optimize anything. Freeing up a bit of CPU and memory headspace should take care of the lag for you.

Upvotes: 3

Related Questions