AdMob導入後、起動時のクラッシュ。
[AdMob][iOS] GADApplicationIdentifier を追加しないとクラッシュ
これがまずありますが、他にも出現しました。
*** 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. Google Ad Manager publishers, follow instructions here: https://googlemobileadssdk.page.link/ad-manager-ios-update-plist’
terminating with uncaught exception of type NSException
podでFirebaseとAdMobを入れて、このエラーが出た場合、多分 -ObjCのフラグが追記されていません。
pod更新後に唐突に出たので、調べてましたが、Info.plistへ以下の項目を追加するという方法が出て来ます。
GADIsAdManagerApp
Boolean値 YES
この項目は、公式ドキュメントに見当たらないものなので、使わない方が良いでしょう。
試すと、エラーは消えましたが。
Google Ad Managerのリリースノートには、7.42.0 2019‑03‑15で、この名称が出てきています。
AdMobのリリースノートには特になし。
TARGETのBuild Settings、Other Linker Flagsに、-ObjCの追加が無難です。
-ObjCを追加後のビルドで、エラーは消えました。