I'm using Google AdMob SDK (latest one downloaded just recently) in my app.
When my app launches it freezes for 4-5 seconds, until the ad is loaded and displayed. Afterwards it runs smoothly. When I comment out the banner request line, the app starts normally.
I have made a custom helper class, in which I have the following code.
- (void) getGoogleBanner:(UIViewController *) targetController
{
self.googleBannerView.rootViewController = targetController;
[self.googleBannerView.rootViewController.view addSubview:self.googleBannerView];
[self.googleBannerView setDelegate:self];
GADRequest* request = [GADRequest request];
[self.googleBannerView loadRequest:request];
}
where
- googleBannerView is a property of my class, and has the type GADBannerView
- I set the frame size and ad unit ID beforehand properly
- targetController is the controller I want to add the banner to
- I call the [CustomClass getGoogleBanner:self] method in viewDidAppear of various different controllers and successfully display the banner, except that first load issue.
I'd like to know if anyone has run into this problem, and how it is solved. I'm open to any ideas that would remove the freezing issue. I tried to running the code to a background thread, but I failed because I'm not very experienced with it.
Any help is much appreciated, thanks in advance.