xcode FIrebase iOS 集成崩溃 - 由无效的 GOOGLE_APP_ID 引起

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44017784/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:58:58  来源:igfitidea点击:

FIrebase iOS integration crash - caused by an invalid GOOGLE_APP_ID

iosxcodecordovafirebase

提问by Sartheris Stormhammer

I am trying to build my Cordova app with Firebase integrated using Xcode build, but I am getting this vague error, and I can't understand what's wrong. I have placed the GoogleService-Info.plistfile in the project directory, but it still fails to build. Here is the stack trace

我正在尝试使用 Xcode 构建集成 Firebase 来构建我的 Cordova 应用程序,但我收到了这个模糊的错误,我不明白出了什么问题。我已将该GoogleService-Info.plist文件放在项目目录中,但它仍然无法构建。这是堆栈跟踪

2017-05-17 09:56:43.610 MyAppz[824:13611] *** Terminating app due to uncaught exception 'com.firebase.core', 
reason: 'Configuration fails. It may be caused by an invalid GOOGLE_APP_ID in GoogleService-Info.plist 
or set in the customized options.'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x00000001099cdb0b __exceptionPreprocess + 171
        1   libobjc.A.dylib                     0x0000000109409141 objc_exception_throw + 48
        2   CoreFoundation                      0x0000000109a36625 +[NSException raise:format:] + 197
        3   MyAppz                            0x0000000107280b70 +[FIRApp addAppToAppDictionary:] + 371
        4   MyAppz                            0x000000010728011b +[FIRApp configureDefaultAppWithOptions:sendingNotifications:] + 285
        5   MyAppz                            0x000000010727fe4f +[FIRApp configure] + 302
        6   MyAppz                            0x000000010721c59a -[AppDelegate(FirebasePlugin) application:swizzledDidFinishLaunchingWithOptions:] + 122
        7   UIKit                               0x000000010a804957 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 299
        8   UIKit                               0x000000010a80623c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4119
        9   UIKit                               0x000000010a80c584 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1709
        10  UIKit                               0x000000010a809793 -[UIApplication workspaceDidEndTransaction:] + 182
        11  FrontBoardServices                  0x000000010fce15f6 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
        12  FrontBoardServices                  0x000000010fce146d -[FBSSerialQueue _performNext] + 186
        13  FrontBoardServices                  0x000000010fce17f6 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
        14  CoreFoundation                      0x0000000109973c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
        15  CoreFoundation                      0x00000001099590cf __CFRunLoopDoSources0 + 527
        16  CoreFoundation                      0x00000001099585ff __CFRunLoopRun + 911
        17  CoreFoundation                      0x0000000109958016 CFRunLoopRunSpecific + 406
        18  UIKit                               0x000000010a80802f -[UIApplication _run] + 468
        19  UIKit                               0x000000010a80e0d4 UIApplicationMain + 159
        20  MyAppz                            0x0000000107195df1 main + 65
        21  libdyld.dylib                       0x000000010cc3a65d start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException

What could be the problem, I don't know what else to show if it's needed, so please ask.

可能是什么问题,我不知道如果需要它还能显示什么,所以请询问。

回答by Sartheris Stormhammer

For some reason Xcode always ignored the GoogleService-Info.plistlocated in the project root directory, and didn't copied it in the Resources folder of the project.

出于某种原因,Xcode 总是忽略GoogleService-Info.plist位于项目根目录中的 ,并没有将其复制到项目的 Resources 文件夹中。

I manually copied the file there, and then the app compiled and ran just fine.

我手动将文件复制到那里,然后应用程序编译并运行得很好。

回答by Black Mamba

In my case the problem was with the cordova copying GoogleService-Info.plistand corrupting it.

就我而言,问题在于cordova 复制GoogleService-Info.plist并损坏了它。

So the solution isyou need to do it manually. Just copy your GoogleService-Info.plistfrom your root folder then go to platforms/ios/project-name/Resourcesand paste it there and then there is another Resources folder in it paste it there too. platforms/ios/project-name/Resources/Resources

所以解决方案是你需要手动完成。只需GoogleService-Info.plist从您的根文件夹复制您的内容,然后转到 platforms/ios/project-name/Resources并将其粘贴到那里,然后其中还有另一个 Resources 文件夹也将其粘贴到那里。 platforms/ios/project-name/Resources/Resources

Then again try to make a build or run it in simulator and it'll be working fine.

然后再次尝试构建或在模拟器中运行它,它会正常工作。

回答by digiwizkid

Possibly your GoogleService-Info.plist file is corrupted. Please redownload and replace it.

可能是您的 GoogleService-Info.plist 文件已损坏。请重新下载并替换它。

original discussion here - Firebase for Cordova

此处的原始讨论 - Cordova 的 Firebase

Hope this helps...

希望这可以帮助...

回答by cnu

Also, when you use the below method,

此外,当您使用以下方法时,

FirebaseApp.configure(name:userName , options: .init(googleAppID: ConfigValues.Firebase.googleAppID, gcmSenderID: ConfigValues.Firebase.gcmSenderID))

make sure you give the proper googleAppID and gcmSenderID, to avoid the similar crash.

确保您提供正确的 googleAppID 和 gcmSenderID,以避免类似的崩溃。

回答by Ashish Kanani

Please redownload GoogleService-Info.plist file from firebase and replace in your project. This solved my issue.

请从 firebase 重新下载 GoogleService-Info.plist 文件并替换到您的项目中。这解决了我的问题。