Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Admob for iOS initialization error?

Discussion in 'Scripting' started by Ljaljevic1120, May 24, 2020.

  1. Ljaljevic1120

    Ljaljevic1120

    Joined:
    Jul 15, 2019
    Posts:
    85
    I'm making a 2D game for iOS that includes Google Admob ads. Every time I try to play the game in the editor, I get this error message:

    Screen Shot 2020-05-22 at 2.46.51 PM.png

    My code should be correct because I have an Android version of my game on the Google Play Store that is working just fine with that same code.

    I don't know what this error message means. If anyone has an idea, it would be greatly appreciated.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    That means "I couldn't connect to the underlying library," which in the editor makes sense.

    Usually these things are guarded by #if directives so they don't throw exceptions in the editor, constructs such as:

    Code (csharp):
    1. #if !UNITY_EDITOR
    2.    // code to actually access the library here
    3. #endif
    But perhaps this package is not properly guarded and is still trying to access the native ios library in the editor.
     
  3. Ljaljevic1120

    Ljaljevic1120

    Joined:
    Jul 15, 2019
    Posts:
    85
    Interesting... I'm running the latest version of Unity (2019.3.14), and I have the latest Admob package installed (5.1.0).

    Do you think this could be an error in the Admob package itself or something on my end that I might be doing wrong?
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    Really could be either... It should be an error you can just ignore. Is it interrupting some of your own initialization?

    You can always make a script that destroys a GameObject when you're in the editor, then mark those Admob objects with it. But they still might run earlier, depending on how they're set up. Or just put your own code in to bypass startup of the library when in the editor.
     
  5. Ljaljevic1120

    Ljaljevic1120

    Joined:
    Jul 15, 2019
    Posts:
    85
    Well, when I click the play button in the editor to run the scene, it displays the error message, but the scene continues to run. The real problem is when I try to build the game for iOS to test on a physical device. The same error message pops up and the editor says I have to fix the error before I can build.

    This is preventing me from publishing to the Apple App Store. I have an Android version of the game Already published on Google Play that is working just fine.
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    Ah, I assumed from this sentence that it was an editor-only problem. I don't have anything else to suggest except to go over the AdMob installation and setup steps carefully once again, google the specific error, etc.
     
  7. Ljaljevic1120

    Ljaljevic1120

    Joined:
    Jul 15, 2019
    Posts:
    85
    Okay, I'll try going through everything once again.
    Thank you for your help, I really appreciate it! :)