【发布时间】:2021-06-11 01:27:37
【问题描述】:
我正在尝试测试 Admob 广告。但是,在应用启动之前它会出现异常
'GADInvalidInitializationException', reason: 'Google Mobile Ads SDK 在没有 AppMeasurement 的情况下进行了初始化。
但是,我已经添加了 AppID 和 cocoapod
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
podfile
target 'My App' do
use_frameworks!
pod 'Google-Mobile-Ads-SDK'
end
信息列表
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Initialize Google Mobile Ads SDK
GADMobileAds.sharedInstance().start(completionHandler: nil)
return true
}
有人遇到过这个问题吗?提前致谢。
【问题讨论】:
-
在项目的构建设置中将 -ObjC 链接器标志添加到其他链接器标志: