//插屏广告
if (wx.createInterstitialAd) {
interstitialAd = wx.createInterstitialAd({adUnitId: 'adunit-c5edd7ddd99ae936'})
interstitialAd.onLoad(() => {
console.log('onLoad event emit')
})
interstitialAd.onError((err) => {
console.log('onError event emit', err)
})
interstitialAd.onClose((res) => {
console.log('onClose event emit', res)
})
}
timeAd = setTimeout(function () {
let nowTime = new Date().getTime()
let startTime = wx.getStorageSync('startTime')
let betTime = (nowTime - startTime) / 1000;
console.log('距离启动时间(秒):' + betTime)
if (betTime > 10) {
if (interstitialAd) {
interstitialAd.show().catch((err) => {
console.error(err)
})
}
}
}, 3e3);
报错信息:Object.values is not a function. (In 'Object.values(xh.show)', 'Object.values' is undefined);at App getPortalConfig function;at setTimeout callback function
把插屏广告封装成一个方法。 直接调用方法
interstitialAd.show().catch((err) => { //这行报错