Firebase:Xcode 找不到配置文件:“GoogleService-Info.plist”

Posted

技术标签:

【中文标题】Firebase:Xcode 找不到配置文件:“GoogleService-Info.plist”【英文标题】:Firebase: Xcode Could not locate configuration file: 'GoogleService-Info.plist' 【发布时间】:2018-09-08 03:02:22 【问题描述】:

3 天前,我尝试启动我的应用程序,但它在启动时崩溃,我执行了所有其他问题的答案中提到的所有步骤。

我确定文件名完全正确:GoogleService-Info.plist,Target Membership 是我的应用我检查它,我将文件添加到复制捆绑资源和编译资源,我清理应用并重建它,我在 Firebase 上重新创建应用控制台,我重启PC和Xcode,同样的错误!!

我使用 firebase 进行云消息传递。我在 AppDelegate 上导入 Firebase,将 FirebaseApp.configure() 添加到 didFinishLaunchingWithOptions。

除了这个我还能做什么才能让它工作???

 2018-03-29 10:54:33.131476+0300 Ajeelk[72808:20293899] 4.11.0 - [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
    2018-03-29 10:54:33.131712+0300 Ajeelk[72808:20293899] 4.11.0 - [Firebase/Core][I-COR000005] No app has been configured yet.
    2018-03-29 10:54:33.170450+0300 Ajeelk[72808:20293848] *** Terminating app due to uncaught exception 'com.firebase.core', reason: '`[FIRApp configure];` (`FirebaseApp.configure()` in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x0000000103f4812b __exceptionPreprocess + 171
        1   libobjc.A.dylib                     0x00000001035dcf41 objc_exception_throw + 48
        2   CoreFoundation                      0x0000000103fbd245 +[NSException raise:format:] + 197
        3   Ajeelk                              0x0000000101512102 +[FIRApp configure] + 352
        4   Ajeelk                              0x0000000101451500 _T06Ajeelk11AppDelegateC11applicationSbSo13UIApplicationC_s10DictionaryVySC0E16LaunchOptionsKeyVypGSg022didFinishLaunchingWithH0tF + 240
        5   Ajeelk                              0x000000010145302a _T06Ajeelk11AppDelegateC11applicationSbSo13UIApplicationC_s10DictionaryVySC0E16LaunchOptionsKeyVypGSg022didFinishLaunchingWithH0tFTo + 186
        6   UIKit                               0x0000000104fc7bca -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 299
        7   UIKit                               0x0000000104fc9648 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4113
        8   UIKit                               0x0000000104fceaeb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
        9   UIKit                               0x00000001053986f8 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
        10  UIKit                               0x000000010576e4c8 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
        11  UIKit                               0x00000001053982f1 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
        12  UIKit                               0x0000000105398b6b -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 696
        13  UIKit                               0x0000000105d16a69 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
        14  UIKit                               0x0000000105d16922 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
        15  UIKit                               0x00000001059f39c8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
        16  UIKit                               0x0000000105bf2b06 _performActionsWithDelayForTransitionContext + 100
        17  UIKit                               0x00000001059f388b -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
        18  UIKit                               0x000000010576db25 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
        19  UIKit                               0x0000000104fcd36a -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
        20  UIKit                               0x00000001055a8605 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
        21  FrontBoardServices                  0x000000010bd48cc0 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
        22  FrontBoardServices                  0x000000010bd517b5 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
        23  libdispatch.dylib                   0x00000001086151ba _dispatch_client_callout + 8
        24  libdispatch.dylib                   0x000000010861a468 _dispatch_block_invoke_direct + 324
        25  FrontBoardServices                  0x000000010bd7d498 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
        26  FrontBoardServices                  0x000000010bd7d14e -[FBSSerialQueue _performNext] + 464
        27  FrontBoardServices                  0x000000010bd7d6bd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
        28  CoreFoundation                      0x0000000103eeb101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
        29  CoreFoundation                      0x0000000103f8af71 __CFRunLoopDoSource0 + 81
        30  CoreFoundation                      0x0000000103ecfa19 __CFRunLoopDoSources0 + 185
        31  CoreFoundation                      0x0000000103ecefff __CFRunLoopRun + 1279
        32  CoreFoundation                      0x0000000103ece889 CFRunLoopRunSpecific + 409
        33  GraphicsServices                    0x000000010995a9c6 GSEventRunModal + 62
        34  UIKit                               0x0000000104fd05d6 UIApplicationMain + 159
        35  Ajeelk                              0x00000001014586b7 main + 55
        36  libdyld.dylib                       0x0000000108689d81 start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException

【问题讨论】:

打开 plist 并将包标识符和其他信息与项目中的匹配。 Bundle 标识符在 firebase 控制台的 plist 文件中是相同的 在控制台和 plist 上好吗,在你的项目中? 我确定在所有地方都一样 好的,请仔细检查“复制捆绑资源”下的“构建阶段”。 【参考方案1】:

您的Xcode 项目正在将默认的Xcode copyPlist 函数覆盖为无操作。因此,Copy Resource Files 部分中不会复制任何 plist 文件。

Ajeelk.xcodeproj/project.pbxproj中删除以下内容:

/* Begin PBXBuildRule section */
        048423361F1F829200C5DC6B /* PBXBuildRule */ = 
            isa = PBXBuildRule;
            compilerSpec = com.apple.compilers.proxy.script;
            fileType = text.plist;
            isEditable = 1;
            outputFiles = (
            );
            script = "# builtin-copyPlist\n";
        ;
/* End PBXBuildRule section */

【讨论】:

以上是关于Firebase:Xcode 找不到配置文件:“GoogleService-Info.plist”的主要内容,如果未能解决你的问题,请参考以下文章

在 SwiftUI 中实现 Firebase 身份验证时,Xcode 13 找不到 FacebookAppID [重复]

如何修复 Xcode 中找不到的“firebase_auth/FirebaseAuthPlugin.h”文件?

Xcode 找不到匹配的配置文件 - Ionic Cordova

找不到匹配的配置文件 Xcode

Xcode 10:找不到此可执行文件的有效配置文件

Xcode 7.2 找不到匹配的配置文件