gpt4 book ai didi

javascript - 错误 : firebase. admob() InterstitialAd.show() 请求的 InterstitialAd 尚未加载,无法显示

转载 作者:行者123 更新时间:2023-12-05 00:35:33 39 4
gpt4 key购买 nike

我正在使用 react-native-firebase/admob 在 react native 中使用 Adbmod,当我尝试在第一次点击时使用插页式广告时,它会打开广告,但从那时起它返回此错误:

Error: firebase.admob () InterstitialAd.show () The requested InterstitialAd has not loaded and could not be shown.
该代码与文档相同,可在此处找到:
https://rnfirebase.io/admob/displaying-ads#banner-ads

最佳答案

基本上,您需要在查看广告后重新加载广告。因此,您可以添加一个 AdEventType.CLOSED 监听器并在那里重新加载广告。

 useEffect(() => {
const eventListener = interstitial.onAdEvent(type => {
if (type === AdEventType.LOADED) {
setLoaded(true);
}
if (type === AdEventType.CLOSED) {
console.log("ad closed");
setLoaded(false);

//reload ad
interstitial.load();
}
});

// Start loading the interstitial straight away
interstitial.load();

// Unsubscribe from events on unmount
return () => {
eventListener();
};
}, []);

关于javascript - 错误 : firebase. admob() InterstitialAd.show() 请求的 InterstitialAd 尚未加载,无法显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62884470/

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