XcodeでFirebaseを使うとassertion failed: Error configuring Google servicesが出てアプリが起動しない

XcodeでFirebaseを利用した新規アプリを作るとassertion failed: Error configuring Google services でアプリが起動しない。 AppDelegate.swiftのこのコードで停止する。

  • GoogleService initialize
// ------------------------------------------------------------------
// Configure tracker from GoogleService-Info.plist.
var configureError: NSError?
GGLContext.sharedInstance().configureWithError( &configureError)
assert(configureError == nil, "Error configuring Google services: \(configureError.debugDescription)")

原因はログに出力されていた。

  • GoogleService initialize
2017-04-12 20:09:38.384400+0900 testapp[4018:1253980] You have enabled the SignIn service in Developer Console, but it appears as though your Podfile is missing the line: 'pod "Google/SignIn" or you may need to run `pod update` in your project directory.
assertion failed: Error configuring Google services: Optional(Error Domain=com.google.greenhouse Code=-106 "Missing expected subspecs." UserInfo={NSLocalizedDescription=Missing expected subspecs., NSLocalizedFailureReason=Some subspecs are not pod installed. See log for details.}): file /Users/bj/develop/multiimgviewer/multiimgviewer/AppDelegate.swift, line 161
2017-04-12 20:09:38.388671+0900 testapp[4018:1253980] assertion failed: Error configuring Google services: Optional(Error Domain=com.google.greenhouse Code=-106 "Missing expected subspecs." UserInfo={NSLocalizedDescription=Missing expected subspecs., NSLocalizedFailureReason=Some subspecs are not pod installed. See log for details.}): file /Users/bj/develop/multiimgviewer/multiimgviewer/AppDelegate.swift, line 161
(lldb) 

Firebaseでプロジェクトを作成してダウンロードしたGoogleService-Info.plistファイルは

SignIn serviceがデフォルトで有効になっている。

そのためにPodfileにGoogle/SignIn が必要になっているのだ。
GoogleService-Info.plistファイル中のIS_SIGNIN_ENABLEDをfalseに設定して、再度ビルドすると、エラーは解消され、アプリが起動した。

  • GoogleService-Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>	
・
・
・

	<key>IS_SIGNIN_ENABLED</key>
	<true/> → falseにする
・
・
・


</dict>
</plist>