I integrated Google AdMob into our app. Everything worked perfectly when I added just Admob. But then we started implementing AdMob mediation. After we added the GoogleMobileAdsMediationFacebook pod app started crashing with the following exception
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[GADRequest sdkVersion]: unrecognized selector sent to class 0x10334f240'
This is what we changed while implementing the mediation In Podfile added the following,
pod 'Google-Mobile-Ads-SDK'
pod 'GoogleMobileAdsMediationFacebook'
When registering the 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)
}
}
}
The above code logs the following,
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
These are the only changes that we made to integrate mediation. When loading the banner or any other ad in the view, App Crashes