将 AdMob 插件添加到 Ionic 项目时出现 Xcode 错误 [英] Xcode Error When Added AdMob Plugin To Ionic Project

查看:24
本文介绍了将 AdMob 插件添加到 Ionic 项目时出现 Xcode 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Ionic 3 项目,它在 Ionic DevApp 和 Xcode 上正常运行.但是当我添加 AdMob Plugin 时,它正常运行 Ionic DevApp 但它不在 Xcode 上运行.我尝试了模拟器和真实设备,但我都有一些错误.

I have an Ionic 3 Project and its running normally on Ionic DevApp And Xcode. But When i added AdMob Plugin , its running normally Ionic DevApp but its not running on Xcode. I tried Simulator and Real Device but i have some mistake both of them.

有我的错误代码;

Terminating app due to uncaught exception
'GADInvalidInitializationException', reason: 
'The Google Mobile Ads SDK was initialized incorrectly. 
Google AdMob publishers should follow instructions here: 

https://googlemobileadssdk.page.link/admob-ios-update-plist 
to include the AppMeasurement framework, 
set the -ObjC linker flag, and set 
GADApplicationIdentifier with a valid App ID. 

Google Ad Manager publishers should follow 
instructions here: 
https://googlemobileadssdk.page.link/ad-manager-ios-update-plist

推荐答案

这个问题已经两天了.问题似乎是 xcode 项目的 plist 文件没有正确设置 admob.所以不得不像这样手动添加它们:

Have had this problem for two days now. The problem seems that the xcode project's plist file is not getting the admob settings right. So had to add them manually like this:

打开ionic-project-root/platforms/ios/your-app-name/"下的 your-app-name-Info.plist 文件并添加以下行:

Open the your-app-name-Info.plist file under "ionic-project-root/platforms/ios/your-app-name/" and add these lines:

<key>GADIsAdManagerApp</key>
<true/>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-XXXXXXX~YYYYYYY</string>

作为 ca-app-pub-XXXXXXX~YYYYYYY 你在 admob 中的 ios 应用 ID.现在错误应该消失了.

Being ca-app-pub-XXXXXXX~YYYYYYY your ios app ID in admob. Now the error should go away.

这篇关于将 AdMob 插件添加到 Ionic 项目时出现 Xcode 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆