首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >统一IronSource Ads iOS不对称误差

统一IronSource Ads iOS不对称误差
EN

Stack Overflow用户
提问于 2020-12-29 13:21:45
回答 1查看 849关注 0票数 0

我正在尝试将IronSource广告整合到我的统一项目中。当我构建我的应用程序,在XCode中打开它,并在我的iPhone 6上运行它进行测试时,我会收到一条消息,告诉我IronSource API没有一个Interstitial。错误信息是:

“(日期) AdManager(<-我脚本的名称) ironSource SDK : IronSource: hasINterstitial false”

另外,Interstitial不初始化。所以"IronSource.Agent.isInterstitialReady()“仍然是假的。我做错了什么?我导入了SDK,并编写了这个脚本(C#):

代码语言:javascript
复制
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

}

( Debug.Logs只用于调试我的问题)谢谢您的帮助!

EN

回答 1

Stack Overflow用户

发布于 2021-01-19 07:29:03

看起来while循环永远不会结束。实际触发广告请求的函数是:

代码语言:javascript
复制
IronSource.Agent.loadInterstitial();

试着做以下工作:

代码语言:javascript
复制
private void InitInterstitial()
{
    IronSource.Agent.init(AppKey, IronSourceAdUnits.INTERSTITIAL);
    Debug.Log("Initializing..."); }    
    IronSource.Agent.loadInterstitial();
}

//Invoked when the Interstitial is Ready to shown after load function is called
void InterstitialAdReadyEvent()
{
    Debug.Log("Ad Loaded");
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65492831

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档