将AdMob插件添加到离子项目时出现Xcode错误 [英] Xcode Error When Added AdMob Plugin To Ionic Project
问题描述
我有一个Ionic 3项目,它在Ionic DevApp和Xcode上正常运行。但是,当我添加AdMob插件时,它可以正常运行Ionic DevApp,但不能在Xcode上运行。我尝试了Simulator和Real Device,但是我两个都犯了一些错误。
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 /并添加以下行:
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>
成为ad-b中的ca-app-pub-XXXXXXX〜YYYYYYY您的ios应用ID。现在错误应该消失了。
Being ca-app-pub-XXXXXXX~YYYYYYY your ios app ID in admob. Now the error should go away.
这篇关于将AdMob插件添加到离子项目时出现Xcode错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!