问题描述
我使用来自React Native Firebase的AdMob。我遵循文档,安装@ react-native-firebase / app和@ react-native-firebase / admob,
创建firebase.json
{
"react-native": {
"admob_android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx","admob_ios_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx"
}
}
然后运行cd ios / && pod install,并像在文档中一样设置请求配置和“欧洲用户同意”。
然后,为广告创建一个组件并设置单位ID
import React from 'react';
import {Platform} from 'react-native';
import {BannerAd,BannerAdSize} from '@react-native-firebase/admob';
function Banner320X100() {
let adUnitId3 =
Platform.OS === 'ios'
? 'ca-app-pub-xxxxxxxx/xxxxxxxx'
: 'ca-app-pub-xxxxxxxx/xxxxxxxx';
return (
<BannerAd
unitId={adUnitId3}
size={BannerAdSize.LARGE_BANNER}
requestOptions={{
requestNonPersonalizedAdsOnly: true,}}
/>
);
}
export default Banner320X100;
我编辑info.plist
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-xxxxxxxx~xxxxxxxx</string>
<key>GAdisAdManagerApp</key>
<true/>
在android上运行良好,在ios上仅测试广告有效。我忘了什么吗?
我收到错误消息
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)