开发者

Why Admob SDK sample project needs Navigationcontroller to work?

I created a new project based on the Admob SDK sample project but stripped out of the rootviewcontroller (UINavigationcontroller). However, it doesn't work. It keeps on complaining it cannot receieve an Ad from network.

When I runs the original project (using UINavigationcontroller) the ads popped up.

That doesn't make sense!!

And check out admobviewprotocol.h. it says the following. Is admob exp开发者_如何学运维ects the viewcontroller be returned to UINavigationController?? If I don't have that it won't work? How odd!

// Return the current view controller (AdMobView should be part of its view hierarchy). // Make sure to return the root view controller (e.g. a UINavigationController, not // the UIViewController attached to it) . - (UIViewController *)currentViewControllerForAdAdMobView *)adView;


After iOS 5, building apps without having a root view controller is strongly discouraged. As we can see it in the warning message "Applications are expected to have a root view controller at the end of application launch".

Just like this, AdMob guys too, want a view controller for being able to receive ads from their network.

If your app doesn't have any view controller, you can just silence your GADBannerView with something like this:

GADBannerView *myGADBannerView;
myGADBannerView.rootViewController = [UIViewController new];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜