我正在制作React Native Expo应用程序。我想将FB广告添加到我的应用中。我已经在文档中完成了所有操作,但是它给了我一个错误:
"errorCode": 1203,
"errorMessage": "The SDK version in the ad request is no longer supported for new apps. Please upgrade to one of the latest versions of the SDK",
},
如何下载最新的fd ads SDK?我从此页面下载了SDK:
https://github.com/expo/expo/tree/master/packages/expo-ads-facebook
我正在使用expo sdk33。请帮助我。我非常需要
代码:
// 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);