0

I have a ViewController that displays iAd banner. I do this by simply including the following line:

    self.canDisplayBannerAds = YES;

Then I present a Leaderboard view controller modally and enable iAd on the Leaderboard as well:

- (void) presentLeaderboards {
GKGameCenterViewController* gameCenterController = [[GKGameCenterViewController alloc] init];
gameCenterController.viewState = GKGameCenterViewControllerStateLeaderboards;
gameCenterController.gameCenterDelegate = self;
gameCenterController.topViewController.canDisplayBannerAds = YES;
[self presentViewController:gameCenterController animated:YES completion: nil];

}

iAd is presented on the Leaderboard view-controller as well. The problem is that when the Leaderboard view controller (gameCenterController in the code above) is dismissed, my presenting view controller that used to display iAd banner no longer shows any iAd.

RawMean
  • 8,374
  • 6
  • 55
  • 82

1 Answers1

0

I found the answer. If I set canDisplayBannerAds right before doing a segue to the model view controller (Leaderboard view-controller) and the when I dismiss the model view controller, set it back to YES, everything works fine and I start getting iAds when I'm back to the main view-controller.

So, of the following right before doing the segue:

self.canDisplayBannerAds = YES;

and then, enable iAd in your main view-controller right after you dismiss the model view-controller:

- (void) gameCenterViewControllerDidFinish:(GKGameCenterViewController*) gameCenterViewController {
[self dismissViewControllerAnimated:YES completion:nil];
self.canDisplayBannerAds = YES;
}
RawMean
  • 8,374
  • 6
  • 55
  • 82