调用InterstitialAd.show()后不显示插屏广告,没有返回成功或失败的回调;
再次调用后,返回失败回调:{errCode: 2003, errMsg: "当前正在播放激励视频广告或者插屏广告,不允许再次展示插屏广告"}。
相关代码如下:
/** 初始化插屏广告 */
private _initInterAd() {
this._interAd = wx.createInterstitialAd({ adUnitId: AD_UNIT_ID })
if (!this._interAd) {
console.log('创建插屏广告组件 fail')
return
}
this._interAd.onError((e) => {
console.log('error', e)
})
this._interAd.onClose(() => {
// TODO
})
}
/** 显示插屏广告广告 */
public showInterAd() {
if (this._interAd) {
this._interAd.show()
.then(() => { console.log("show success") })
.catch((err) => {
console.error('_interAd show error', err)
// 失败后重新加载广告
this._interAd.load()
.catch((err) => {
console.error('load', err)
})
})
}
}
用真机调试,开发工具需要10秒后才能看到