Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Ads not working on iOS (tested on an iPhone X and iPod 5)

Discussion in 'Unity Ads & User Acquisition' started by bilalakil, Dec 18, 2018.

  1. bilalakil

    bilalakil

    Joined:
    Jan 28, 2018
    Posts:
    76
    Have tried to get Unity Ads running for my game on both iOS and Android. I went for a very straight-forward setup, where initalisation is being performed automatically - all I'm doing is showing an ad when the player dies.

    This worked without a hitch on Android, but is not working at all on iOS. I've tried on an iPhone X and iPod 5, both with the same errors being shown in the Xcode logs:

    Code (CSharp):
    1.  
    2. 2018-12-18 11:56:10.801863+1100 ios[40281:11791094] I/UnityAds: +[UnityAds initialize:delegate:testMode:] (line:68) :: Initializing Unity Ads 2.3.0 (2300) with game id <REDACTED> in production mode
    3. 2018-12-18 11:56:10.820485+1100 ios[40281:11791396] I/UnityAds: -[UADSInitializeStateConfig execute] (line:159) :: Unity Ads init: load configuration from https://config.unityads.unity3d.com/webview/2.3.0/release/config.json
    4. 2018-12-18 11:56:11.209780+1100 ios[40281:11791396] I/UnityAds: -[UADSInitializeStateLoadWeb execute] (line:228) :: Unity Ads init: loading webapp from https://webview.unityads.unity3d.com/webview/2.3.0/<REDACTED>/release/index.html
    5. 2018-12-18 11:56:12.230398+1100 ios[40281:11791094] I/UnityAds: +[UADSApiSdk WebViewExposed_logInfo:callback:] (line:59) :: Requesting configuration from https://publisher-config.unityads.unity3d.com/games/<REDACTED>/configuration?bundleId=<REDACTED>&encrypted=true&rooted=false&platform=ios&sdkVersion=2300&osVersion=12.1&deviceModel=iPhone10%2C3&language=en_AU&test=false&analyticsUserId=<REDACTED>&analyticsSessionId=<REDACTED>&advertisingTrackingId=<REDACTED>&limitAdTracking=false&frameworkName=Unity&frameworkVersion=2018.3.0f1&adapterName=Packman&adapterVersion=2.3.0
    6. 2018-12-18 11:56:12.546589+1100 ios[40281:11791094] E/UnityAds: +[UADSApiSdk WebViewExposed_logError:callback:] (line:49) :: {"line":18506,"column":20,"sourceURL":"file:///var/mobile/Containers/Data/Application/<REDACTED>/Library/Caches/UnityAdsWebApp.html?platform=ios&origin=https://webview.unityads.unity3d.com/webview/2.3.0/<REDACTED>/release/index.html&version=<REDACTED>"}
    7.  
    I'm not even sure what the error is? How should I go about debugging this?
     
  2. DenisasK

    DenisasK

    Unity Technologies

    Joined:
    Oct 13, 2016
    Posts:
    89
    Hello @bilalakil,
    This is not an error, please, can you collaborate more and explain how "Ads not working at all in iOS".
     
  3. bilalakil

    bilalakil

    Joined:
    Jan 28, 2018
    Posts:
    76
    The ENTIRE set of code used for Ads:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Advertisements;
    3.  
    4. public class Ads : MonoBehaviour
    5. {
    6.     void Awake() =>
    7.         Player.SubGameOver(
    8.           () => Advertisement.Show()
    9.         );
    10. }
    This works a treat on Android, and does nothing at all on iOS. It does not even trigger a warning or error - simply nothing happens. `SubGameOver` certainly works fine, otherwise the entire game flow wouldn't be working, so I don't suspect that to be the cause of any issues here.

    Those 5 messages in the previous post are literally all of the Unity Ad related messages I ever see - they come up as the app is loading, and then there are no more ad related messages. This is why I've asked "How should I go about debugging this?"

    I'm not quite sure how to elaborate. What should I look for, or what information can I provide to help figure this out?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  5. bilalakil

    bilalakil

    Joined:
    Jan 28, 2018
    Posts:
    76
    Hmm, after a night's sleep I tried throwing in some logs to help debug, and suddenly it worked. Maybe the iOS ad server was down yesterday or something? Strange, but a relief.

    But that's good, automatic initialisation + Advertisement.Show() is enough for it to work! Some more helpful logs/messages might be needed, but at least the best case scenario is solid :)

    Thanks for your time!
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, isReady was likely false, and there is likely more information in the device logs