首页 > 解决方案 > Google AdMob - “在没有应用程序 ID 的情况下初始化”错误

问题描述

我正在尝试在我的应用中使用 Google AdMob。但是,该应用程序在启动时不断崩溃。我相信我已经正确初始化了 AdMob,因为我在GADApplicationIdentifier我的文件中添加了所需的键和值Info.plist,而且我也GADMobileAds.sharedInstance().start(completionHandler: nil)AppDelegate.swift.

这是我的错误日志:

2019-10-02 00:23:18.731486-0400 App Name[15066:162231] [Crashlytics] Version 3.14.0 (144)

2019-10-02 00:23:18.741556-0400 App Name[15066:162311] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}

2019-10-02 00:23:18.742118-0400 App Name[15066:162335] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}

2019-10-02 00:23:18.743045-0400 App Name[15066:162335] [Client] Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}

2019-10-02 00:23:18.746628-0400 App Name[15066:162311] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}

2019-10-02 00:23:18.746676-0400 App Name[15066:162336] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}

2019-10-02 00:23:18.747969-0400 App Name[15066:162311] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}

2019-10-02 00:23:18.748361-0400 App Name[15066:162337] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.}

2019-10-02 00:23:18.787064-0400 App Name[15066:162231] *** Terminating app due to uncaught exception 'GADInvalidInitializationException', reason: 'The Google Mobile Ads SDK was initialized without an application ID. Google AdMob publishers, follow instructions here: https://googlemobileadssdk.page.link/admob-ios-update-plist to set GADApplicationIdentifier with a valid App ID. Google Ad Manager publishers, follow instructions here: https://googlemobileadssdk.page.link/ad-manager-ios-update-plist'

这适用于 Swift 5 和 iOS 13。

标签: iosxcodeadmob

解决方案


像这样向您的 Info.plist 文件添加GADIsAdManagerApp正值:

在此处输入图像描述

这对我来说是固定的崩溃。


推荐阅读