I'm trying to integrate IronSource ads into my Unity Project. When I build my app, open it in XCode and run it on my iPhone 6s for testing, I get a message telling me that the IronSource API hasn't got an Interstitial.
The Error Message is:
"(DATE) AdManager(<- The Name of my Script) [ironSource SDK] API: IronSource: hasINterstitial false"
Also, the Interstitial Ad does not initialize. So "IronSource.Agent.isInterstitialReady()" stays false.
What am I doing wrong?
I have imported the SDK and I wrote this Script (C#):
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AdManager : MonoBehaviour
{
private string AppKey = "MY_APP_ID";
void Start()
{
Invoke("InitInterstitial", 4);
}
#region interstitial
private void InitInterstitial()
{
IronSource.Agent.init(AppKey, IronSourceAdUnits.INTERSTITIAL);
while (!IronSource.Agent.isInterstitialReady()) { Debug.Log("Initializing..."); }
Debug.Log("Initialized!");
IronSource.Agent.loadInterstitial();
Debug.Log("Loaded!");
}
void OnEnable()
{
IronSourceEvents.onInterstitialAdReadyEvent += InterstitialAdReadyEvent;
IronSourceEvents.onInterstitialAdLoadFailedEvent += InterstitialAdLoadFailedEvent;
IronSourceEvents.onInterstitialAdShowSucceededEvent += InterstitialAdShowSucceededEvent;
IronSourceEvents.onInterstitialAdShowFailedEvent += InterstitialAdShowFailedEvent;
IronSourceEvents.onInterstitialAdClickedEvent += InterstitialAdClickedEvent;
IronSourceEvents.onInterstitialAdOpenedEvent += InterstitialAdOpenedEvent;
IronSourceEvents.onInterstitialAdClosedEvent += InterstitialAdClosedEvent;
}
//Invoked when the initialization process has failed.
//@param description - string - contains information about the failure.
void InterstitialAdLoadFailedEvent(IronSourceError error)
{
Debug.LogError("ERROR!!__: " + error);
}
//Invoked right before the Interstitial screen is about to open.
void InterstitialAdShowSucceededEvent()
{
}
//Invoked when the ad fails to show.
//@param description - string - contains information about the failure.
void InterstitialAdShowFailedEvent(IronSourceError error)
{
}
// Invoked when end user clicked on the interstitial ad
void InterstitialAdClickedEvent()
{
}
//Invoked when the interstitial ad closed and the user goes back to the application screen.
void InterstitialAdClosedEvent()
{
}
//Invoked when the Interstitial is Ready to shown after load function is called
void InterstitialAdReadyEvent()
{
Debug.Log("_______READY!_____");
}
//Invoked when the Interstitial Ad Unit has opened
void InterstitialAdOpenedEvent()
{
}
public void ShowInterstitial()
{
IronSource.Agent.showInterstitial();
}
#endregion
}
(The Debug.Logs are only for debugging my problem) Thanks for your Help!