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

时间:2018-03-29 08:23:50

标签: ios xcode firebase firebase-cloud-messaging

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

我确定文件名完全正确:GoogleService-Info.plist,Target Membership是我的应用程序我检查它,我将文件添加到Copy Bundle Resources和Compile Resources,我清理应用程序并重建它,我在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

1 个答案:

答案 0 :(得分:1)

您的Xcode项目将默认的Xcode copyPlist函数覆盖为no-op。因此,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 */