Реклама на Facebook не работает с экспо SDK 33 - PullRequest
0 голосов
/ 09 июля 2019

Я обновил мой Expo SDK до последней версии (33.0.0).Я изменил все, что мне нужно (я изменил импорт объявлений fb следующим образом:

import * as FacebookAds from 'expo-ads-facebook'; и загрузил его).

Когда я запустил это приложение 2 дня назад (я был на SDK32) все было хорошо, но теперь ... Я прочитал, что все, что мне нужно изменить, так что работа fb ads была просто импорт и загрузка.Когда я запускаю свое приложение, fb ads не показывается и выдает в консоли эту ошибку:

error SyntheticEvent {
  "_dispatchInstances": FiberNode {
    "tag": 5,
    "key": null,
    "type": "ViewManagerAdapter_CTKBannerView",
  },
  "_dispatchListeners": [Function onError],
  "_targetInst": FiberNode {
    "tag": 5,
    "key": null,
    "type": "ViewManagerAdapter_CTKBannerView",
  },
  "bubbles": undefined,
  "cancelable": undefined,
  "currentTarget": 1255,
  "defaultPrevented": undefined,
  "dispatchConfig": Object {
    "registrationName": "onAdError",
  },
  "eventPhase": undefined,
  "isDefaultPrevented": [Function functionThatReturnsFalse],
  "isPropagationStopped": [Function functionThatReturnsFalse],
  "isTrusted": undefined,
  "nativeEvent": Object {
    "errorCode": 1002,
    "errorMessage": "Ad was re-loaded too frequently",
  },
  "target": undefined,
  "timeStamp": 1562671873682,
  "type": undefined,
}

Что я делаю не так?Код:

// page.js
import React from 'react';

import { View } from 'react-native';
import { createStackNavigator, createAppContainer } from 'react-navigation'; // Version can be specified in package.json
import * as FacebookAds from 'expo-ads-facebook';

import AdScreenFacebook from './AdScreenFacebook'

const adsManager = new FacebookAds.NativeAdsManager("2272791379702600_2272795453035526", 10);

class AdScreen extends React.Component {
  render () {
          return (
  <View>
  <AdScreenFacebook adsManager={adsManager} />

  <FacebookAds.BannerAd
      placementId="2272791379702600_2272803043034767"
      type="standard"
      onPress={() => console.log('click')}
      onError={error => console.log('error', error)}
    />
    </View>
          );
      }

 }


  export default createStackNavigator(
    {
      Main: {
        screen: AdScreen,
      },
      AdScreenFacebook: {
        screen: AdScreenFacebook,
      }
    },
    {
      initialRouteName: 'Main',
    }
  );
  
  // AdScreenFacebook.js
  
  import React from 'react';

import { StyleSheet, Text, View, Dimensions } from 'react-native';

import * as FacebookAds from 'expo-ads-facebook';
const { AdTriggerView, AdMediaView, AdIconView } = FacebookAds;


class AdScreenFacebook extends React.Component {
  render () {
          return (
            <View style={{  flexDirection: 'column',
    justifyContent: 'center',
    alignItems: 'center',}}>
            <View style={{ width:500}}>
                   <AdMediaView style={{ width: 160, height: 90 }}/>
                   <View style={{flexDirection: 'row'}}>
                   <AdIconView style={{ width: 50, height: 50 }}/>
                   <AdTriggerView>
                     <Text>{this.props.nativeAd.bodyText}</Text>
                       <Text>{this.props.nativeAd.callToActionText}</Text>
                   </AdTriggerView>
                 </View>
                  </View>
                    </View>
    );
      }

 }


export default FacebookAds.withNativeAd(AdScreenFacebook);

1 Ответ

0 голосов
/ 09 июля 2019

Обновление FB SDK - это открытый выпуск прямо сейчас.

В настоящее время подтверждается, что сборка Экспо не выполняется в условиях, которые не разделяются, что приводит к ошибкам.

Если вы хотите использовать его сейчас, вы запускаете expo eject (используйте Expokit)

...