FacebookAds not working: Returns "Error: Ad was re-loaded too frequently"

Please provide the following:

  1. SDK Version: 39
  2. Platforms: Android & iOS

Facebook Ads does not seem to work as of now? When trying to display interstitial ads only a error message which does not seem to be relevant is displayed.

“Error: Ad was re-loaded too frequently”

https://docs.expo.io/versions/latest/sdk/facebook-ads/

Hey @eridr880,

Can you share the code you’ve implemented for this? Based on the error, it seems like your app may be re-rendering too often and needs to be revised. If you can reproduce this error, with a bare bones implementation then we can dive into it.

Cheers,
Adam

const placementIds here is “censored” but I’ve used ids from Facebooks Monetization Manager.

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

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

  // Test Device
  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(() => {
          console.log('Interstitial Ad Shown')
        })
        .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'
  }
})

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.