gpt4 book ai didi

c# - AdColony SDK 在当前平台上不可用

转载 作者:行者123 更新时间:2023-11-29 23:55:27 24 4
gpt4 key购买 nike

当我尝试使用时出现错误:

 Ads.Configure(this.AppID, appOptions, this.zoneIDs);

错误说:

AdColony SDK unavailable on current platform

这就是我尝试播放广告的方式:

public string AppID = "app53f882d220464f3399";
public string[] zoneIDs = new string[] { "vz53cbba96e85e4170b4", "vz53cbba96e85e4170b4" };

public void WatchADs()
{
ConfigureAds();
RegisterForAdsCallbacks();
// RegisterForAdsCallbacksReward();
RequestAd();
PlayAd();
//RestartLevel();
}

void ConfigureAds()
{
// AppOptions are optional
AdColony.AppOptions appOptions = new AdColony.AppOptions();
appOptions.UserId = "JackAlope";
appOptions.TestModeEnabled = true;
appOptions.AdOrientation = AdColony.AdOrientationType.AdColonyOrientationAll;
if (Application.platform == RuntimePlatform.Android ||
Application.platform == RuntimePlatform.IPhonePlayer)
{
Ads.Configure(this.AppID, appOptions, this.zoneIDs);
}
}

void RegisterForAdsCallbacks()
{
AdColony.Ads.OnRequestInterstitial += (AdColony.InterstitialAd ad) => {
_ad = ad;
};

AdColony.Ads.OnExpiring += (AdColony.InterstitialAd ad) => {
AdColony.Ads.RequestInterstitialAd(ad.ZoneId, null);
};
}

void RequestAd()
{
AdColony.AdOptions adOptions = new AdColony.AdOptions();
adOptions.ShowPrePopup = true;
adOptions.ShowPostPopup = true;
if (Application.platform == RuntimePlatform.Android ||
Application.platform == RuntimePlatform.IPhonePlayer)
{
AdColony.Ads.RequestInterstitialAd(zoneIDs[0], adOptions);
}
}

void PlayAd()
{
if (_ad != null)
{
AdColony.Ads.ShowAd(_ad);
}
}

最佳答案

您当前的平台模式可能是 AdColony SDK 不支持的平台之一。 Android 和 iOS 支持 AdColony SDK。通过 File ---> Build Settings 菜单从 Build Settings 切换到 Android 或 iOS 或使用代码来防止在任何非 Android 或 iOS 平台上调用 Ads.Configure.

在运行时进行检查:

if (Application.platform == RuntimePlatform.Android ||
Application.platform == RuntimePlatform.IPhonePlayer)
{
Ads.Configure(this.AppID, appOptions, this.zoneIDs);
}

或者编译时:

#if UNITY_ANDROID || UNITY_IOS  
Ads.Configure(this.AppID, appOptions, this.zoneIDs);
#endif

关于c# - AdColony SDK 在当前平台上不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50422142/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com