Bug 38178 - Google AdMob integration - iOS - Interstitial Ads - CC 1.7.1.0 Black Screen Problem
Summary: Google AdMob integration - iOS - Interstitial Ads - CC 1.7.1.0 Black Screen P...
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: XI 9.4 (iOS 9.2)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-01-29 14:23 UTC by Zahi Kramer
Modified: 2016-02-08 12:53 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
iOS project with CC and Admob Interstitial ad - Black screen problem (207.69 KB, application/zip)
2016-01-29 14:23 UTC, Zahi Kramer
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Zahi Kramer 2016-01-29 14:23:42 UTC
Created attachment 14787 [details]
iOS project with CC and Admob Interstitial ad - Black screen problem

Hi.
It relates to Cocossharp , don't know exactly where to put it here...

Regarding Peter Post here:
[http://forums.xamarin.com/discussion/35803/google-admob-integration-interstitial-ads](http://forums.xamarin.com/discussion/35803/google-admob-integration-interstitial-ads)

I'm trying to implement interstitial ads on my game in iOS with CC 1.7.1.0.
I implemented Admob Interstitial Ads first.
On Xamarin forms (latest ver.) everything is ok. Ad is popped up and when clicked close it closed
and the previous page is seen again.
But,
for Cocossharp Game, when activating the ad, popup is good, but when closing, the ad is shrinking down
as it should, BUT THE PREVIOUS PAGE (OF THE GAME) IS TURN BLACK!
(actually it turns to the background of CCGameView , if it was white it will be white)

THE GAME IS STILL CONTINUES , you can even click with the mouse and if you have sound you can hear response,
BUT NO VISUAL! only black (background) color.

I thought it was the ads provider problem (first Admob) but i tried it also with Facebook , and EXACTLY the
same behavior!
So the problem is with CC 1.7.1. I'm working on it last 3 days and couldn't find what is changing after the ad dropped down.

I took Peter sample project, Refactored it to CC 1.7.1.0 and you can see it yourself.
The same behavior is for pure CC or for CC inside Xamarin.forms.
Attached here.

Android is ok.

Anyone?
Comment 2 rami.tabbara 2016-01-30 04:16:07 UTC
Hi,

I'm able to reproduce this problem and we'll take a look at the issue. As you've seen in this forum post (https://forums.xamarin.com/discussion/35692/interstitial-ad-in-admob-throws-nullreferenceexception), it appears to be tied to the iPhoneOSGameView so we have a good starting point.

(In reply to Zahi Kramer from comment #0)
> Created attachment 14787 [details]
> iOS project with CC and Admob Interstitial ad - Black screen problem
> 
> Hi.
> It relates to Cocossharp , don't know exactly where to put it here...
> 
> Regarding Peter Post here:
> [http://forums.xamarin.com/discussion/35803/google-admob-integration-
> interstitial-ads](http://forums.xamarin.com/discussion/35803/google-admob-
> integration-interstitial-ads)
> 
> I'm trying to implement interstitial ads on my game in iOS with CC 1.7.1.0.
> I implemented Admob Interstitial Ads first.
> On Xamarin forms (latest ver.) everything is ok. Ad is popped up and when
> clicked close it closed
> and the previous page is seen again.
> But,
> for Cocossharp Game, when activating the ad, popup is good, but when
> closing, the ad is shrinking down
> as it should, BUT THE PREVIOUS PAGE (OF THE GAME) IS TURN BLACK!
> (actually it turns to the background of CCGameView , if it was white it will
> be white)
> 
> THE GAME IS STILL CONTINUES , you can even click with the mouse and if you
> have sound you can hear response,
> BUT NO VISUAL! only black (background) color.
> 
> I thought it was the ads provider problem (first Admob) but i tried it also
> with Facebook , and EXACTLY the
> same behavior!
> So the problem is with CC 1.7.1. I'm working on it last 3 days and couldn't
> find what is changing after the ad dropped down.
> 
> I took Peter sample project, Refactored it to CC 1.7.1.0 and you can see it
> yourself.
> The same behavior is for pure CC or for CC inside Xamarin.forms.
> Attached here.
> 
> Android is ok.
> 
> Anyone?
Comment 3 Zahi Kramer 2016-01-30 17:27:28 UTC
Great! Thanks.
Looking forward to the fix.

Regarding the post [https://forums.xamarin.com/discussion/35692/interstitial-ad-in-admob-throws-nullreferenceexception](https://forums.xamarin.com/discussion/35692/interstitial-ad-in-admob-throws-nullreferenceexception)
As you see there i didn't have the exception mentioned there, but events won't fire on CC (on XF everything was good).
But.
I succeeded to find a workaround to that problem.
On CC for some reason the Delegate object of Admob InterstitialAd object turned to be null (inside XF after registering events it wasn't null , but when activating the game in CC and firing from there the Admob InterstitialAd object ,its property "Delegate" (of type InterstitialAdDelegate) was null.
So,
I Re registered the events inside CC (created new InterstitialAdDelegate object) and re registered the events , and now THE EVENTS START FIRING.

FYI
Comment 4 rami.tabbara 2016-02-06 04:06:34 UTC
There's a proposed fix for this in the latest master [branch](https://github.com/mono/CocosSharp). If possible, can you build from source and see if this sorts out the issues you are encountering?


(In reply to Zahi Kramer from comment #3)
> Great! Thanks.
> Looking forward to the fix.
> 
> Regarding the post
> [https://forums.xamarin.com/discussion/35692/interstitial-ad-in-admob-throws-
> nullreferenceexception](https://forums.xamarin.com/discussion/35692/
> interstitial-ad-in-admob-throws-nullreferenceexception)
> As you see there i didn't have the exception mentioned there, but events
> won't fire on CC (on XF everything was good).
> But.
> I succeeded to find a workaround to that problem.
> On CC for some reason the Delegate object of Admob InterstitialAd object
> turned to be null (inside XF after registering events it wasn't null , but
> when activating the game in CC and firing from there the Admob
> InterstitialAd object ,its property "Delegate" (of type
> InterstitialAdDelegate) was null.
> So,
> I Re registered the events inside CC (created new InterstitialAdDelegate
> object) and re registered the events , and now THE EVENTS START FIRING.
> 
> FYI
Comment 5 Zahi Kramer 2016-02-07 13:52:59 UTC
WORKING!
Great!
Thanks Rami!
Comment 6 rami.tabbara 2016-02-08 12:53:26 UTC
Great to hear that it works. This fix will be incorporated into our next release.