larsacus / LARSAdController

Lightweight ad mediation for iOS to properly manage multiple ad networks dynamically including iAd and Google ads.
http://theonlylars.com/blog/2013/01/10/stupid-easy-ads-with-larsadcontroller-3-dot-0/
MIT License
269 stars 60 forks source link

Banners flashes and doesn't return #103

Closed Jonomato closed 9 years ago

Jonomato commented 9 years ago

For my iOS app 'My Dance Class Free' I used your Larsadviewcontroller , displaying iAd and Admob ads. It is released in the Appstore since Nov 1st. It is a tabbar model. So when I download it from the store and opens it, it behaves normal showing iAds. But when I close it and restart it , the banner flashes 1 time and then doesn't come up anymore nor after hours. Only when I reboot my iphone5 , it will come up with ads. And the second time it fails again. In testing mode I can not find strange behaviour and this doesn't occur. I myself think that the app does not return to initial state or something. It is pulling ad requests. But I don't have a clue why it flashes.

enmiller commented 9 years ago

Are you using the latest Cocoapod release? If so, can you post some logs or a hierarchy trace of when you think the Ad bar should be visible but isn't.

Jonomato commented 9 years ago

I use version 3.0. the output 2014-11-04 16:44:20.915 MDCF[281:38249] iAd did fail to receive ad

2014-11-04 16:44:21.487 MDCF[281:38249] Google ad did receive ad

2014-11-04 16:44:22.028 MDCF[281:38249] Banner view is beginning an ad action"

So after iAd failed, admob comes in apparently but banner is not shown. I tested it only on my iPhone 5 , (iOS8) other mobile devices I had tested in the simulator

larsacus commented 9 years ago

@Jonomato Please try the latest CocoaPods release and let me know if you still have issues (v3.0.7)

Jonomato commented 9 years ago

@larsacus It seemed that I was using the latest v3.0.7, but for being sure I updated it and also new cocoa pods release. Anyhow I tested it and here is the output: 2014-11-06 12:15:45.165 MDCF[674:316956] Banner view is beginning an ad action 2014-11-06 12:16:50.316 MDCF[674:316956] Banner view is beginning an ad action 2014-11-06 12:18:15.489 MDCF [674:316956] To get test ads on this device, call: request.testDevices = @[ @"34d13af6aea438cdabd9313369432a1b" ]; 2014-11-06 12:18:15.515 MDCF[674:316956] iAd did fail to receive ad 2014-11-06 12:18:17.314 MDCF[674:316956] Banner view is beginning an ad action 2014-11-06 12:23:15.914 MDCF[674:316956] iAd did fail to receive ad 2014-11-06 12:23:15.931 MDCF[674:316956] iAd did fail to receive ad 2014-11-06 12:23:17.518 MDCF[674:316956] Google ad did receive ad 2014-11-06 12:23:18.971 MDCF[674:316956] Banner view is beginning an ad action 2014-11-06 12:28:15.089 MDCF[674:316956] iAd did fail to receive ad 2014-11-06 12:28:15.096 MDCF[674:316956] iAd did fail to receive ad 2014-11-06 12:28:15.863 MDCF[674:316956] Banner view is beginning an ad action 2014-11-06 12:28:15.962 MDCF[674:316956] Google ad did receive ad 2014-11-06 12:29:02.637 MDCF[674:316956] Banner view is beginning an ad action

Note: when the app starts there is an iAd, Closing my app and restarting it : iAd failed, and no banner view, >waiting 5 mins>iAd failed again,no banner view , no Google ads, >waiting another 5 mins>iAd banner became visible.>closing the app and restart>iAd stays visible , but a 3rd time Adbanner flashes off the screen again. So the behaviour is unpredictable.

larsacus commented 9 years ago

How are you setting the delegate to get these custom logs that you sent?

Jonomato commented 9 years ago

In the Appdelegate.m , in didFinishWithLaunchingOptions I have this : [[LARSAdController sharedManager] registerAdClass:[TOLAdAdapteriAds class]]; [[LARSAdController sharedManager] registerAdClass:[TOLAdAdapterGoogleAds class] withPublisherId: @"ca-app-pub-****/****"]; In the views .m files where I use ads : I use - (void)viewWillAppear:(BOOL)animated{ [[LARSAdController sharedManager] addAdContainerToViewInViewController:self]; } In the header files I did not implement the ad delegates,and did not import the iAd and GADBannerView frameworks, as I understand that shouldn't be done?

larsacus commented 9 years ago

So who is outputting those logs you pasted? Those are not my logs. Also make sure you are calling [super viewWillAppear:animated] when you override viewWillAppear:.

Jonomato commented 9 years ago

Sorry that I am confusing you, not my intention,I appreciate your help . I had put those logs myself for the purpose of testing. Because I found out that when the troubles began ,there wasn't anything in the output. I removed my logs and added [super viewWillAppear:animated] as you suggested in my views. From the build , it happened again, that banner flashes off. No logs. After that I started the app from my device, and tested it for a while. It seemed that the flashing behaviour was gone. For another test I put Google admob in first order. And the admob banners worked perfectly. No more flashing off. So your advice did the trick.I am much grateful for your help.Thanks. I'm a happy guy and your adcontroller is awesome.I will recommend it!

larsacus commented 9 years ago

Hmm.. not sure what the actual issue was, but I'm glad you got it resolved.

Jonomato commented 9 years ago

On the Github page you wrote:" Then the only line of code you need in your view controller is to add the container to your view using either of the following in viewWillAppear:: [[LARSAdController sharedManager] addAdContainerToView:self.view withViewController:self]; " In my case it ended with troubles.Well the only thing I have changed is to add [super viewWillAppear:animated] in void ViewWillAppear. And it is still working as expected.