我将 Google AdMob 集成到我们的应用中。当我只添加 Admob 时,一切都运行良好。但后来我们开始实施 AdMob 中介。在我们添加 GoogleMobileAdsMediationFacebook pod 应用程序开始崩溃后,出现以下异常
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[GADRequest sdkVersion]: unrecognized selector sent to class 0x10334f240'
这是我们在 Podfile 中实现中介时所做的更改,添加了以下内容,
pod 'Google-Mobile-Ads-SDK'
pod 'GoogleMobileAdsMediationFacebook'
注册admob时,
func register() {
GADMobileAds.sharedInstance().start(completionHandler: nil)
let ads = GADMobileAds.sharedInstance()
ads.start { status in
// Optional: Log each adapter's initialization latency.
let adapterStatuses = status.adapterStatusesByClassName
for adapter in adapterStatuses {
let adapterStatus = adapter.value
NSLog("Adapter Name: %@, Description: %@, Latency: %f", adapter.key,
adapterStatus.description, adapterStatus.latency)
}
}
}
上面的代码记录了以下内容,
2021-04-08 12:55:03.428056+0600 Quran Touch[542:38566] Adapter Name: GADMediationAdapterFacebook, Description: <GADAdapterStatus: 0x28158aa60; state = Not Ready;Adapter failed to initialize. Adapter raised an exception during setup. Adapter: GADMediationAdapterFacebook, Exception: +[GADRequest sdkVersion]: unrecognized selector sent to class 0x10334f240>, Latency: 0.184458
2021-04-08 12:55:03.428157+0600 Quran Touch[542:38566] Adapter Name: GADMobileAds, Description: <GADAdapterStatus: 0x2815f01e0; state = Ready>, Latency: 0.022223
这些是我们为整合调解所做的唯一更改。在视图中加载横幅或任何其他广告时,应用程序崩溃