Closed walsht closed 11 years ago
The code path looks correct and the root view controller is getting set properly on the google ads when it is getting created. The only thing I can think of is that the reference to the root view controller in all contexts is a weak
reference. This means that if the view controller that the ads are currently hosted in gets deallocated by the system and cleaned up, this warning could result.
As of now, I can find nothing wrong with the code-path relating to setting the root view controller.
After looking at this further, it looks like this may have been possible when adding an ad to a new view controller. Check out commit e7ff542 to see if this resolves the issue.
Still getting the warning. The problem is that it never recovers and shows a ad.
I am only showing Google Ads, may have something to do with it? Or, it looks like I am only getting this in the ipad simulator.
Thanks.
Here are the logs:
2013-01-29 05:43:20.734 MyApp[57559:c07] -[AppDelegate application:didFinishLaunchingWithOptions:] line 25 $
2013-01-29 05:43:20.943 MyApp[57559:c07] LARSAdController [line 184]: View is portrait
2013-01-29 05:43:20.944 MyApp[57559:c07] LARSAdController [line 207]: Container frame: {{0, 914}, {768, 90}}
2013-01-29 05:43:20.944 MyApp[57559:c07] LARSAdController [line 520]: Creating new instance of adapter class "TOLAdAdapterGoogleAds"
2013-01-29 05:43:20.974 MyApp[57559:c07] LARSAdController [line 560]: Successfully created instance of "TOLAdAdapterGoogleAds"
2013-01-29 05:43:20.974 MyApp[57559:c07] LARSAdController [line 471]: Initial banner frame
Are you changing view controllers when this happens? It looks like you're changing orientations, does this always happen only when you change orientations? If you could do some debugging and find out exactly if the parentViewController
property is actually nil, or is simply never getting assigned to the bannerView
.
Just doing some testing on the AdMob banner example and found that it looks like it has to do with [self.bannerView setNeedsLayout];
If I call this before [_bannerView loadRequest:request];
It is fine, but after it gives me the warning.
Hope this helps.
The admob banner example as in the vanilla Google AdMob example code from Google's site? Or my sample project?
There is absolutely no reason why setNeedsLayout
would affect the rootViewController
's property unless it's a bug within Google's framework.
I was testing using the Google AdMob example code, when I mess with the setNeedsLayout I was getting the issue. Looks like your code is working fine on the devices, just a simulator issue.
I have decided to build my own add display. If you could add the ability to have iAd display if successful over Admob, I may add that into future projects. I just get better revenue from iAD if it is available.
Thanks, TIm
The framework as it is will support whatever ad network priority you would like to define. If you would like to have iAd always display first, then simply register the ad adapters in this order:
[[LARSAdController sharedManager] registerAdapterClass:[TOLAdAdapteriAds class]];
[[LARSAdController sharedManager] registerAdapterClass:[TOLAdAdapterGoogleAds class]];
This tells the ad controller that you always want iAds to display when they are available and to display AdMob ads when there are no iAds. It will fill the gaps in depending on what priority you register them in.
I see, and didn't know that. Few other things that would be helpful:
Thanks, Tim
I'd be happy to entertain a pull request with this functionality added.
Google adapter complaining about not setting root view controller. So, I added this line in TOLAdAdapterGoogleAds: - (GADBannerView *)bannerView{
Not showing issue all the time and not sure if it would work for all uses, but works for me.