Warning: Attempt to present <GADBrowserViewController: 0x7fc9c49c17c0> on ViewController

414 views
Skip to first unread message

anu...@vserv.com

unread,
Apr 25, 2016, 3:39:44 AM4/25/16
to Google Mobile Ads SDK Developers
Hi All,
I hope someone can help me with this. I've integrated google admob into a project. I'm displaying an ad icon added as a subview to a viewcontroller, say A. On click of the icon i'm displaying the GADNativeAppInstallAdView/GADNativeContentAdView but in a modal uiview controller, say B with modalPresentationStyle = UIModalPresentationOverCurrentContext. The icon object subview in viewcontroller A has a view controller property (the view controller A) and it does the presenting via:

[self.nativeAdViewController presentViewController:self.popupView animated:NO completion:nil];

The popupView being the icon objects property, which is the view controller containing the GADNativeAppInstallAdView/GADNativeContentAdView subview.

The issue arises wherein, if I click the adchoices icon inside the view, I get the following warning in the debugger:
Warning: Attempt to present <GADBrowserViewController: 0x7fc9c49c17c0>  on <ViewController: 0x7fc9c243d950> which is already presenting (null).

How can I resolve this?

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Apr 25, 2016, 1:13:37 PM4/25/16
to Google Mobile Ads SDK Developers
Hi Anup,

I have been unable to reproduce the issue here. Would you be able to send us a sample app that does so and we would have a look. There could be an issue with the way you are trying to present the View Controller.

Thanks,
Veer Busani
Mobile Ads SDK Team

anu...@vserv.com

unread,
Apr 27, 2016, 4:08:50 AM4/27/16
to Google Mobile Ads SDK Developers
Hi Veer,
I've created a sample for your perusal. Here is the link to download it: https://drive.google.com/file/d/0B25m_5ijR7y7cVVURThZcEdjdHM/view?usp=sharing
Its the banner sample modified to show a native ad. Kindly ignore the layout of the native ad, its disfigured since I didn't work on it. If you click the ad choices icon, it shows the same log in the debugger as I reported earlier.

2016-04-27 13:33:16.713 BannerExample[8842:88654] <Google> To get test ads on this device, call: request.testDevices = @[ kGADSimulatorID ];

 

2016-04-27 13:33:17.641 BannerExample[8842:88582] Received native app install ad: <GADNativeAppInstallAd: 0x7f986bde90b0>

2016-04-27 13:33:17.653 BannerExample[8842:88648] <Google> Assigned view prevents Google Mobiles Ads SDK user interaction.

Set view.userInteractionEnabled = NO to enable Google Mobile Ads SDK click handling.

View: <UIButton: 0x7f986bc914a0; frame = (272 174; 38 29); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7f986bc917d0>>

2016-04-27 13:33:19.093 BannerExample[8842:88582] Warning: Attempt to present <GADBrowserViewController: 0x7f986e093130>  on <ViewController: 0x7f986bdc1c20> which is already presenting (null)



Kindly let me know what could be the issue.
Thanks.

anu...@vserv.com

unread,
Apr 27, 2016, 4:14:25 AM4/27/16
to Google Mobile Ads SDK Developers
Attaching a screenshot.
Screen Shot 2016-04-27 at 1.43.22 pm.png

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Apr 27, 2016, 3:45:31 PM4/27/16
to Google Mobile Ads SDK Developers
Hi Anup,

I have created a new project, that would incorporate Native App Install AdView, being presented as a Modal View from your Parent ViewController. All of the required UI Elements for the GADNativeAppInstallAdView were declared programmatically and I have eliminated the use of XIBs for this. Do let us know if you need anything else.


Thanks,
Veer Busani
Mobile Ads SDK Team

anu...@vserv.com

unread,
Apr 28, 2016, 12:17:13 AM4/28/16
to Google Mobile Ads SDK Developers
Hi Veer,
Thank you for the project. I will review it and get back to you in case I have any more queries.
Thanks.

anu...@vserv.com

unread,
Apr 28, 2016, 12:23:09 AM4/28/16
to Google Mobile Ads SDK Developers
Hi Veer,
I hope its not too much to ask, could you upload a sample using Objective-C ? Also could you let me know what was going wrong in the original sample?
Thank you.

anu...@vserv.com

unread,
Apr 28, 2016, 12:38:08 AM4/28/16
to Google Mobile Ads SDK Developers
Also if I may add one more question and recapture my previous questions for brevity (apologies on not thinking through all of my questions and multiple posting):
1. Could you please provide an Objective-C sample I could take a look at?
2. Could you also point out why there was a problem with the original sample that I attached?
3. Is there any difference in creating the view programmatically than using xibs? (Since the project I need to get this working in does so)
Much appreciate your time and response.
Thanks Veer!

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
Apr 28, 2016, 12:22:20 PM4/28/16
to Google Mobile Ads SDK Developers
Hi Anup,

  • I have converted the project into Objective-C for you. 
  • The issues with your sample project were - 
    • You were not considering the Modal View and its constraints properly. When trying to use both XIB or Storyboards with programatic use of NSLayoutConstraints, it would create a problem. As a best practice, it is always recommended to use one and stick to it. That's why I originally wanted to show how this is done completely through code itself. 
    • The other issue with your build was that it was not a clean project. There were several other elements in the project, such as BannerView, which was not playing nicely with improper Interface Builder connections to the header class.
  • As I have mentioned, it's a good practice to use either one. If you know how to do so, then there should not be any problem whatsoever. For your case, I have built using both XIBs and little programatic use of NSLayoutConstraints.
Thanks,
Veer Busani
Mobile Ads SDK Team

anu...@vserv.com

unread,
May 2, 2016, 12:56:59 AM5/2/16
to Google Mobile Ads SDK Developers
Hi Veer,
Thank you so much for the updated project, your insights were very helpful. However, there seems to be a problem on clicking the ad choices icon at the top right in the native ad displayed inside the modal on running the project via simulator. The debugger shows the following log: 

2016-05-02 10:19:57.588 Native Ad Modal Obj-C[1313:15667] Warning: Attempt to present <GADBrowserViewController: 0x7f83c25b9df0>  on <ViewController: 0x7f83c24311c0> which is already presenting <AdViewController: 0x7f83c258eda0>

Please see attached screenshot.


So while the issue of "...which is already presenting 'null' "  is resolved, there is still the problem of the 

GADBrowserViewController not being able to present itself due to the modal presentation nature of the ad view controller. This has been the main problem for me in regards to the implementation. Any ideas how this can be addressed or fixed?
Thanks.
Screen Shot 2016-05-02 at 10.20.18 am.png

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
May 2, 2016, 12:28:21 PM5/2/16
to Google Mobile Ads SDK Developers
Hi Anup,

With Modal presentation, the View Controller would not be able to overlay/present another View Controller on top of it, when it is already presenting one. I would suggest you to dismiss the AdViewController, which would allow the root View Controller to present the overlay. I have also further modified the sample app to implement this.

Thanks,
Veer Busani
Mobile Ads SDK Team

anu...@vserv.com

unread,
May 4, 2016, 5:33:29 AM5/4/16
to Google Mobile Ads SDK Developers
Hi Veer,
Thank you for the update, it is as I had expected. Will implement the suggested way.
Thanks.

bradfor...@gmail.com

unread,
May 14, 2016, 7:52:50 PM5/14/16
to Google Mobile Ads SDK Developers
I'm having the same issue Warning: Attempt to present <GADInterstitialViewController: 0x7fc31445e4d0> on <...C: 0x7fc317b25d90> whose view is not in the window hierarchy!

What is the Equivalent of solving this problem via swift??

Veer Arjun Busani(Mobile Ads SDK Team)

unread,
May 16, 2016, 9:11:18 AM5/16/16
to Google Mobile Ads SDK Developers
Hi there,

Would you mind confirming the same with our sample app? I suspect that issue is with the way you are trying to present the Interstitial AdView. For me to debug the issue, I would need to look at your implementation code. Do send me this and I would have a look further. 

Thanks,
Veer Busani
Mobile Ads SDK Team

bradford gray

unread,
May 16, 2016, 10:01:11 AM5/16/16
to google-adm...@googlegroups.com
Thanks for your response. Actually just solved it yesterday. It had to do with how I was presenting the view controllers.

Sent from my iPhone
--

---
You received this message because you are subscribed to a topic in the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-admob-ads-sdk/1HRvchJ6qfU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-admob-ads...@googlegroups.com.
To post to this group, send email to google-adm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages