问题
I'm sure there's a simple answer to this but it's beginning to annoy me now!
I have an iAd integrated into my app which appears and works on the screen I've implemented it in. The app uses a NavigationController to move between multiple screens, but the iAd is only on one of them. After moving from start to finish through my app several times I get a message appear in GDB saying:
Too many active banners (11). Creation of new banners will be throttled.
The app then crashes.
I have tried looking through the Apple documentation and searched on Google and can't see a solution to the problem.
If anyone has any idea how I can resolve the issue it would definitely stop me from going mad! Thanks.
回答1:
It sounds like you're not removing your iAds when views hide. I suggest doing the creation in viewWillAppeaer
and removing ads in the viewDidDisappear
method. Like this, you'l only end up with as many banners as you create in the visible view. It sounds like you're using the viewdidLoad
/viewWillUnload
pair instead.
回答2:
Another alternative is to create the ADBannerView in a fixed location across all screens. It's a little bit harder than the above method, but it looks nice. For example, if you have a tab bar controller application, you can do the following in your app delegate:
[self.myTabBarController.view addSubview:self.myAdView];
It can get a little bit tricky to place other views underneath the ad.
来源:https://stackoverflow.com/questions/7030452/taking-an-iad-across-multiple-screens