我有一个 Ionic 3 项目,它在 Ionic DevApp 和 Xcode 上正常运行。但是当我添加 AdMob Plugin 时,它正常运行 Ionic DevApp 但它不在 Xcode 上运行。我尝试了模拟器和真实设备,但我都遇到了一些错误。
有我的错误代码;
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。所以必须像这样手动添加它们:
打开“ionic-project-root/platforms/ios/your-app-name/”下的 your-app-name-Info.plist 文件并添加以下行:
<key>GADIsAdManagerApp</key>
<true/>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-XXXXXXX~YYYYYYY</string>
ca-app-pub-XXXXXXX~YYYYYYY 是你在 admob 中的 ios 应用 ID。现在错误应该消失了。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)