React native 显示间隙面书广告返回“;错误:Ad重新加载的频率太高;

React native 显示间隙面书广告返回“;错误:Ad重新加载的频率太高;,react-native,expo,expo-ads-facebook,React Native,Expo,Expo Ads Facebook,间隙FacebooksAds的显示返回“错误:Ad重新加载过频繁” 我添加了两个: “facebookAppId”:“XYZ123”, “facebookDisplayName”:“ABC”到App.json 我正在使用iphonexs设备和exposdk39 我已经尝试使用带有我的placementId的测试广告类型,但根据我的const placementId,错误仅从“错误:服务器错误”到“错误:广告重新加载过频繁”有所不同 我尝试了多个测试ID,但都返回了错误:(DEMO_AD_TYPE

间隙FacebooksAds的显示返回“错误:Ad重新加载过频繁”

我添加了两个: “facebookAppId”:“XYZ123”, “facebookDisplayName”:“ABC”到App.json

我正在使用iphonexs设备和exposdk39

我已经尝试使用带有我的placementId的测试广告类型,但根据我的const placementId,错误仅从“错误:服务器错误”到“错误:广告重新加载过频繁”有所不同

我尝试了多个测试ID,但都返回了错误:(DEMO_AD_TYPE#YOUR_PLACEMENT_ID)

观众网络有一个绿色的复选标记,所以我假设facebook开发者仪表板中的所有设置都是正确的

import React from 'react'
import { StyleSheet, SafeAreaView, Button, Platform } from 'react-native'
import * as FacebookAds from 'expo-ads-facebook'

export default function testScreen({ routes, navigation }) {
  // Interstitial Id
  const placementId =
    Platform.OS === 'ios'
      ? 'xxxxxxxxxxxxxxxx_yyyyyyyyyyyyyyyy'
      : 'aaaaaaaaaaaaaaaa_bbbbbbbbbbbbbbbb'


  FacebookAds.AdSettings.addTestDevice(FacebookAds.AdSettings.currentDeviceHash)

  let expirationDate: any
  // Prevent ad from loading more often than once every minute
  const displayAd = () => {
    console.log(expirationDate)
    if (!expirationDate || new Date() > expirationDate) {
      expirationDate = new Date(new Date().getTime() + 1 * 60 * 1000)

      FacebookAds.InterstitialAdManager.showAd(placementId)
        .then((didClick) => {
          console.log('Interstitial Ad Shown ' + didClick)
        })
        .catch((error) => {
          console.log('Interstitial Ad ' + error)
        })
    } else {
      console.log('Ad re-loaded too frequently')
    }
  }

  return (
    <SafeAreaView style={styles.container}>
      <StatusBar style="auto" />
      {/* TEST SCREEN */}
      <Button title="Button" onPress={displayAd} />
    </SafeAreaView>
  )
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center'
  }
})
从“React”导入React
从“react native”导入{样式表、SafeAreaView、按钮、平台}
从“expo ads facebook”导入*作为FacebookAds
导出默认函数testScreen({routes,navigation}){
//间质Id
常量位置ID=
Platform.OS===“ios”
?'XXXXXXXXXXXXXX uyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
:“aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
FacebookAds.AdSettings.addTestDevice(FacebookAds.AdSettings.currentDeviceHash)
到期日期:有吗
//防止ad加载频率超过每分钟一次
constdisplayad=()=>{
console.log(过期日期)
如果(!expirationDate | | new Date()>expirationDate){
expirationDate=新日期(新日期().getTime()+1*60*1000)
FacebookAds.InterstitularAdminManager.showAd(placementId)
.然后((点击)=>{
console.log('显示间隙广告'+didClick)
})
.catch((错误)=>{
console.log('间隙Ad'+错误)
})
}否则{
console.log('广告重新加载太频繁')
}
}
返回(
{/*测试屏幕*/}
)
}
const styles=StyleSheet.create({
容器:{
弹性:1,
为内容辩护:“中心”,
对齐项目:“中心”
}
})

世博会似乎使用了一个弃用的Facebook SDK。()