Search Unity

Unity Ads don't work on iOS

Discussion in 'Unity Ads' started by vvoojj, Apr 30, 2016.

  1. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    635
    Link isn't working.
     
  2. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    401
  3. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    635
    I disabled the ads from the service panel, imported the 2.0.2 package changed the script to put my ids along with test mode, and now i get 5 errors on a script that worked great 5 mins ago on devices.
    "Ambiguous reference 'Advertisement': UnityEngine.Advertisements.Advertisement, UnityEngine.Advertisements.Advertisement."

    Remove the package, everything works.
     
  4. BartNT

    BartNT

    Joined:
    Sep 12, 2013
    Posts:
    12
    Any news about fix for integrated Ads (enabled via services) in portrait mode on iOS?

    My game is portrait only and Ads are still not displayed on iOS devices (even with "use video orientation according to the orientation of the device" enabled). Everythings works great on Android and on iOS from Unity Editor with the same code.
     
  5. Mikea15

    Mikea15

    Joined:
    Sep 20, 2012
    Posts:
    93
    This was fixed in an updated version of Unity I think.
     
  6. BartNT

    BartNT

    Joined:
    Sep 12, 2013
    Posts:
    12
    @Mikea15 I have this issue on Unity 5.5.0p4 :/
     
  7. Yawarshah

    Yawarshah

    Joined:
    Nov 2, 2015
    Posts:
    13
    I am still having some issue with the Ads. The Ads works fine in the editor but when I publish the game and test it on the device it just wont show.

    I am using Unity 5.6. Please advise.
     
  8. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    235
    hello all, please help me , i have this problem when open scene 1not show ads and i have in console : Trying to Invoke method: UnityAdsInitializer.ShowAds couldn't be called.

    then if i load map then exit map from first scene1 it show ads
    this is my code and please help me :
    Code (CSharp):
    1. using UnityEngine;
    2. #if UNITY_ANDROID
    3. using UnityEngine.Advertisements;
    4. #endif
    5.  
    6. public class UnityAdsInitializer : MonoBehaviour
    7. {
    8.     [SerializeField]
    9.     private string
    10.     androidGameId = "18658",
    11.     iosGameId = "18660";
    12.  
    13.     [SerializeField]
    14.     private bool testMode;
    15.     bool off_Ads = false;
    16.     string gameId;
    17.     void Start ()
    18.     {
    19.         gameId = null;
    20.  
    21.         #if UNITY_ANDROID
    22.         gameId = androidGameId;
    23.         #elif UNITY_IOS
    24.         gameId = iosGameId;
    25.         #endif
    26.  
    27.         //if (Advertisement.isSupported && !Advertisement.isInitialized) {
    28.         //    Advertisement.Initialize(gameId, testMode);
    29.         //
    30.         InvokeRepeating("Init_Ads",0f,6f);
    31.         Invoke ("ShowAds", 5f);
    32.         Showads ();
    33.     }
    34.  
    35.     void Init_Ads()
    36.     {
    37.         #if UNITY_ANDROID || UNITY_IOS
    38.         Advertisement.Initialize(gameId, testMode);
    39.         //print ("Ads Shown");
    40.         #endif
    41.     }
    42.  
    43.     void Showads()
    44.     {
    45.         #if UNITY_ANDROID || UNITY_IOS
    46.         Advertisement.Show ();
    47.         //print ("Ads Shown
    48.         #endif
    49.     }
    50.  
    51. }
     
  9. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    635
    Most probably you are not initializing Ads at the right time. It needs some time before it's able to prepare and show an add.
    Initialize the Ads the moment your game starts, even before showing your main menu.
    That way it'll have time to communicate with the services server and prepare an ad.
     
  10. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    235
    on unity ads 1.0 was work ok but on unity ads 2.0 is this problem, i need to show ads when open menu scene because i have menu scene where choose map and map scene so i only add unity ads in scene main not on map . Thanks.
     
  11. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    635
    Still, load the ads service even before that. Like on the scene that you show your logo, before the menu scene.
    Not on the same frame, one right after the other. if you call an add to show right after you execute init_ads, i don't think it even has time to contact the service. So it doesn't even have an ad ready to show, and so it fails.
    Which is why when you go back to your menu from a level, it works. The service had time to load.
    And you only need to init the service once. I don't think you need invoke repeat with init ads.
     
  12. tsondhi2006

    tsondhi2006

    Joined:
    Sep 4, 2016
    Posts:
    10
    i am on unity version 5.6.2f1 and google ad plugin 3.7.1, i have copy pasted exact code as in the developer guide:-

    private void RequestBanner()
    {
    #if UNITY_EDITOR
    string adUnitId = "unused";
    #elif UNITY_ANDROID
    string adUnitId = "--[android banner ad id here]--";
    #elif UNITY_IPHONE
    string adUnitId = "--[ios banner ad id here]--";
    #else
    string adUnitId = "unexpected_platform";
    #endif

    // Create a 320x50 banner at the top of the screen.
    BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
    // Create an empty ad request.
    AdRequest request = new AdRequest.Builder().Build();
    // Load the banner with the request.
    bannerView.LoadAd(request);
    }

    But still the ads arent popping up on ios whereas ads on android are working perfectly...