Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
App crash when hiding ad the second time (Admob) — Gideros Forum

App crash when hiding ad the second time (Admob)

HolonistHolonist Member
edited March 2017 in Bugs and issues
Hi,

I would like to give players the ability to show/hide ads for a little bonus.

In my app, currently an ad is loaded and shown on start.

When you click the button, the ad hides. As intended
When you click the button again, the ad (or a new one, not sure) displays. As intended
When you click the button once again, my app crashes. (should simply hide again...)

simplified code in my button click listener:
--ad initialization
ad = Ads.new("admob")
-- ...
 
ad:showAd("banner", unitID)
showAds = true
 
--this goes inside my button:onclick()
if showAds == true then
	showAds = false
 
	if ad then
		ad:hideAd("banner")
	end
else
	showAds = true
 
	if ad then
		ad:showAd("banner")
	end
end




Comments

  • I'm an idiot.
    The crash was not because of ads.
    It was because of a sprite that I remove too, but then forgot to add again on the next button click.

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.