Google AdMob GADBannerView first request takes long time and freezes UI
Asked Answered
I

1

7

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.

Intracutaneous answered 23/1, 2013 at 22:53 Comment(4)
Can you elaborate on what kind of UI you have specifically and where the GADBannerView is in your hierarchy? A 4-5 second delay sounds pretty big, are you doing some sort of complex drawing/animations?Lundgren
I'm not doing any complex drawing. Actually all of the application consists of UIViews and 2-3 TableViews. The tables never have more than 50 elements. I have also tried sending the loadRequest: method to a background thread, however it didn't work, with an error that is related to modifying the main window from a background thread. This function is probably already asynchronous, because it is a standart Google method and the response is catched by Google Banner View delegate.Bayer
it happens he same to me! Did you find any solution?Fraudulent
In the release notes for AdMob 6.12.0 it says: "Ad loading takes less time on the main thread on iOS 8". Perhaps with a recent version of AdMob this issue is addressed.Striker
B
2

I've got the issue only when running in the simulator, so if this is the case, you shouldn't probably worry.

From what I could find, when calling the loadRequest method, the framework will also call canOpenURL: method (UIApplication). From some tests that I ran (on both simulator and iOS devices with 5.1.1 and 6.1.3), canOpenURL occasionally freezes for few seconds on the simulator (once it took it 20 seconds to return), however, works well on the devices.

Blurb answered 26/7, 2013 at 10:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.