24

I'm not very experienced in the IOS development. This is my first try to implement Google AdMob to my application, and I get this error when I try to run the simulator: Terminating app due to uncaught exception 'GADInvalidInitializationException', reason: 'The Google Mobile Ads SDK was initialized without AppMeasurement. Google AdMob publishers, follow instructions here: https://googlemobileadssdk.page.link/admob-ios-update-plist to include the AppMeasurement framework and set the -ObjC linker flag.

I'm using Xcode 12 beta on macOS Big Sur. I tried to reinstall Google pod a couple of times, but still get the same error. Please help

Daniel Storm
  • 18,301
  • 9
  • 84
  • 152
Rut
  • 245
  • 2
  • 7
  • I've been having the same issue after updating AdMob SDK using Cocoapods. I kept my cocoapods install, but still did step 2 of https://developers.google.com/admob/ios/quick-start#manual_download. Now it works, but I don't get why the documentation states that cocoapods should be enough – dvkch Mar 02 '21 at 12:13
  • Did you put the SDK framework files to your project or just added the -ObjC to Other Linker Flags? – Rut Mar 03 '21 at 14:45
  • I just added the flag. The frameworks were already installed via Cocoapods, but somehow the cocoapods config for AdMob didn't update the main project configuration to add this flag – dvkch Mar 04 '21 at 15:29

4 Answers4

52

Manually add the -ObjC linker flag to Other Linker Flags in your target's build settings even if you're using CocoaPods or Swift Package Manager.

Manually adding the -Obj` linker flag to Other Linker Flags

Daniel Storm
  • 18,301
  • 9
  • 84
  • 152
43

Try to add this property in your Info.plist file enter image description here

It works for me

Zim
  • 674
  • 7
  • 15
0

For anyone who using Swift Package Manager, go to your target and change the version rule from main to the next major (enter the latest version - 9.0.0 at the moment) and it should work:

enter image description here

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Evu79
  • 1
  • 1
0

UI of Xcode Version 14 >=

For anyone who has encountered this problem recently, this is the UI for Xcode version 14 or newer. You must set the -ObjC flag for both the "Debug" and "Release" configurations.

kenxdrgn
  • 13
  • 3