Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Reisender · Jul 13, 2014 at 06:48 PM · errorads

Handling empty ADBannerView (iOS, Unity 4.5.1 Free)

I've added an ADBannerView to my game following the code in the Unity docs (http://docs.unity3d.com/ScriptReference/ADBannerView.html), and I've been testing it thorougly to make sure it won't show empty banners (Apple seems to be very strict when it comes to reviewing games with Ads, and reject those that show empty banners).

Most of the time, the banner behaves as expected: it shows when an ad is loaded and hides when "iAd library is not available". But, from time to time (unfortunately not when I'm debugging from Xcode, but when I'm playing the game far from my computer), the deadly empty banner appears. I do not know how to reproduce this error, it just happens sometimes.

I've been looking for a way to handle this, but I cannot find a property, event or delegate in the ADBannerView class to do so.

This is what I'm doing: I created an iAdManager class which creates and shows the banner, and I call this class in my Main Menu scene like this:

 public class MainMenuController : MonoBehaviour {
         // some code...
         private iAdManager adManager;
 
     void Awake(){
         // some code
 
         adManager = new iAdManager();
         adManager.ShowBanner();
     } 
 
         // more code
 }

And the code for the AdManager class is this:

 public class iAdManager {
 #if UNITY_IOS
     private ADBannerView banner = null;
 
     public iAdManager(){
         ADBannerView.onBannerWasClicked += onAdClicked;
         ADBannerView.onBannerWasLoaded += onAdLoaded;
     }
 #endif
 
     public void ShowBanner(){
 #if UNITY_IOS
         if(ADBannerView.IsAvailable (ADBannerView.Type.Banner)){
             Debug.Log(this.ToString () + ": App running in iOS, preparing banner.");
             banner = new ADBannerView(ADBannerView.Type.Banner, ADBannerView.Layout.Bottom);
         } else {
             Debug.Log(this.ToString () + "." + ADBannerView.Type.Banner.ToString () + ": is not available.");
         }
 #else
         Debug.Log(this.ToString () + ": App not running in iOS, banner will not show at all.");
 #endif
     }
 
     private void onAdClicked(){
         Debug.Log(this.ToString () + ": Banner was clicked!");
     }
     
     private void onAdLoaded(){
         Debug.Log(this.ToString () + ": Banner is loaded!");
 #if UNITY_IOS
         banner.visible = true;
         if(banner.visible && !banner.loaded) banner.visible = false;
 #endif
     }
 }

As you can see, I'm trying to handle errors with a "if(banner.visible && !banner.loaded) banner.visible = false;" but this doesn't seem to work all the time.

Any ideas?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by povilas · Jul 11, 2015 at 03:21 AM

The issue is being worked on. Please see http://forum.unity3d.com/threads/adbanner-omission-on-ios.336929/ for progress.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Google Ads Integration problems 1 Answer

AdMob real ads don't show but test ads work as expected 0 Answers

iAds scripting problem 0 Answers

Advertisement.isready ("rewardedVideo") always returns false 1 Answer

When I click on anything on the services windows it shows me this error? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges