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

Admob Rewarded Ads on iOS?

Discussion in 'iOS and tvOS' started by Deleted User, Jun 19, 2017.

  1. Deleted User

    Deleted User

    Guest

    Hey guys,
    I have a rewarded video on my app for generating keys, which the user uses to open crates.
    I am using admob, and have setup the unity plugin (official) and the pod file as per google documentation.
    However, whenever I press the button when testing to load the ad (on physical hardware, unity is set to device SDK), i get the SIGABRT error, and with this output from the debugger in Xcode:
    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADURewardBasedVideoAd isReady]: unrecognized selector sent to instance 0x17009c520'

    *** First throw call stack:

    (0x191e2efe0 0x190890538 0x191e35ef4 0x191e32f54 0x191d2ed4c 0x100146464 0x1001330cc 0x100507c50 0x100e7ad10 0x1008d9bac 0x1008d2830 0x1009ac0d0 0x10078b9c8 0x1008709c8 0x100a12008 0x1001090f4 0x100108fe0 0x102cc44fc 0x1950405dc 0x19504048c 0x19209bb9c 0x191dc5960 0x191dddae4 0x191ddd284 0x191ddad98 0x191d0ada4 0x193774074 0x197fc5058 0x100102bbc 0x190d1959c)

    libc++abi.dylib: terminating with uncaught exception of type NSException

    I guessed the reason for the crash was to do with the 'isReady' value for the ad, however I am not sure where to take it from there.
    Xcode/iOS noob here, any help is much appreciated:
    Thanks
     
  2. unityplayer1989

    unityplayer1989

    Joined:
    Jul 15, 2017
    Posts:
    4
    Download Admob Unity3d Plugin https://github.com/unity-plugins/Unity-Admob

    Installation Admob Unity

    Open your project in the Unity editor.
    Navigate to Assets -> Import Package -> Custom Package.
    Select the AdmobUnityPlugin.unitypackage file.
    Import all of the files for the plugins by selecting Import. Make sure to check for any conflicts with files.


    Init Admob Unity Plugin

    Create A C# script ,drag the script to a object on scene , add the follow code in the script file

    using admob;
    Admob.Instance().initAdmob("admob banner id", "admob interstitial id");//admob id with format ca-app-pub-279xxxxxxxx/xxxxxxxx
    //Admob.Instance().initAdmob("ca-app-pub-3940256099942544/2934735716", "ca-app-pub-3940256099942544/4411468910");


    Here is the minimal code to create an admob video.

    Admob.Instance().loadRewardedVideo("ca-app-pub-3940256099942544/1712485313");

    Video need to be explicitly shown at an appropriate stopping point in your app, check that the video is ready before showing it:

    if (Admob.Instance().isRewardedVideoReady()) {
    Admob.Instance().showRewardedVideo();
    }




    Hope it helps you
     
  3. agokoglu

    agokoglu

    Joined:
    Sep 23, 2014
    Posts:
    3
    hi unityplayer1989,
    how to check reward video when user cancel video or success view end of video?
    Also The plugin doc says using reward do these steps Do you know why we need these actions?
    thank you,

    1.add and enable third platform on apps.admob.com and set platform params
    unityads reqires appid and placement

    2.download third platform sdk (some platform not reqired) and sdk adapter,add those files to
    Plugins/Android/libs/ or Plugins/iOS/

    unityads reqires unityads jar and unityads adapter jar for android ,framework and adapter .a for ios
    3.edit AndroidManifest.xml and add platform reqired config or add reqired framewords for ios

    unityads reqired activity for android