LoginSignup
5

More than 3 years have passed since last update.

iosのabmobやgoogle ad managerでGADInvalidInitializationExceptionが発生した場合

Last updated at Posted at 2019-03-19

こんなエラーが出た場合の解決方法

*** Terminating app due to uncaught exception 'GADInvalidInitializationException', reason: 'The Google Mobile Ads SDK was initialized incorrectly. Google AdMob publishers should follow instructions here: https://googlemobileadssdk.page.link/admob-ios-update-plist to include the AppMeasurement framework, set the -ObjC linker flag, and set GADApplicationIdentifier with a valid App ID. Google Ad Manager publishers should follow instructions here: https://googlemobileadssdk.page.link/ad-manager-ios-update-plist'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001146301bb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x0000000113bd6735 objc_exception_throw + 48
	2   CoreFoundation                      0x000000011462fd29 -[NSException raise] + 9
	3   Runner                              0x0000000109f2f680 GADVerifyApplicationID + 148
	4   Runner                              0x0000000109f30266 GADVerifyApplicationID + 3194
	5   libdispatch.dylib                   0x000000011239d595 _dispatch_call_block_and_release + 12
	6   libdispatch.dylib                   0x000000011239e602 _dispatch_client_callout + 8
	7   libdispatch.dylib                   0x00000001123ab99a _dispatch_main_queue_callback_4CF + 1541
	8   CoreFoundation                      0x00000001145953e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	9   CoreFoundation                      0x000000011458fa76 __CFRunLoopRun + 2342
	10  CoreFoundation                      0x000000011458ee11 CFRunLoopRunSpecific + 625
	11  GraphicsServices                    0x00000001177ef1dd GSEventRunModal + 62
	12  UIKitCore                           0x000000011dcd281d UIApplicationMain + 140
	13  Runner                              0x00000001098bbda4 main + 68
	14  libdyld.dylib                       0x0000000115ce8575 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

これらは、Google Mobile Ads SDK version 7.42.0から必須になった以下をすれば解決します。

admobの場合

info.plistに以下を追加。アプリIDを記述する

<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>

アプリIDは、以下を参考

Google Ad Managerの場合

info.plistに以下を追加

<key>GADIsAdManagerApp</key>
<true/>

結論

これらは、英語のドキュメントにすれば書いてあります。
英語のドキュメントを見よう。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
5