firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.55k stars 1.45k forks source link

Terminating app due to uncaught exception 'FABException', reason: '[Fabric] Value of Info.plist key "Fabric" must be a NSDictionary.' #4578

Closed MelanyG closed 4 years ago

MelanyG commented 4 years ago

I want to migrate existing project that uses Crashlytics with Fabric to Firebase (as it is going not be supported soon). After searching and following instructions I thought I managed to configure it, but it crashes when I try to configure Firebase.

 [FIRApp configure];
 [Fabric with:@[[Crashlytics class]]];

My pod file looks like this:

use_frameworks!

platform :ios, '10.0'

workspace 'Fifi24'

project 'xoxo/xoxo.xcodeproj'
project 'fifi/fifi.xcodeproj'

def common_pods

    pod 'GoogleAnalytics'
    pod 'Google-Mobile-Ads-SDK'
    pod 'GoogleAds-IMA-iOS-SDK-For-AdMob', '~> 3.2.1'
    pod 'GoogleIDFASupport'
    pod 'Fabric', '~> 1.10.2'
    pod 'Crashlytics', '~> 3.14.0'

    pod 'Firebase/Core'
    pod 'Firebase/Messaging'
    pod 'Firebase/AppIndexing'
    pod 'Firebase/Analytics'

end

target :xoxoPresentation do

    pod 'Google-Mobile-Ads-SDK'
    pod 'GoogleAds-IMA-iOS-SDK-For-AdMob', '~> 3.2.1'
    pod 'GoogleIDFASupport'
    pod 'Crashlytics', '~> 3.14.0'
    pod 'Fabric', '~> 1.10.2'
    pod 'Firebase/Core'

    project 'xoxo/xoxo.xcodeproj'
end

target :xoxoCommon do
    pod 'GoogleAnalytics'
    pod 'Fabric', '~> 1.10.2'
    pod 'Crashlytics', '~> 3.14.0'
    pod 'Firebase/Analytics'

    project 'xoxo/xoxo.xcodeproj'
end

target :xoxoDomain do

    pod 'Crashlytics', '~> 3.14.0'

    project 'xoxo/xoxo.xcodeproj'
end

target :xoxoPersistence do

    pod 'Fabric', '~> 1.10.2'
    pod 'Crashlytics', '~> 3.14.0'
    project 'xoxo/xoxo.xcodeproj'
end

target :fifi do
    common_pods

    pod 'GoogleSignIn'
    pod 'TwitterKit'

    project 'fifi/fifi.xcodeproj'
end

target :fifiDev do
    common_pods

    pod 'GoogleSignIn'
    pod 'TwitterKit'

    project 'fifi/fifi.xcodeproj'
end

I added GoogleService-Info.plist to the project

What i did: I had in Info.plist as it was needed previously

    <key>Fabric</key>
    <dict>
        <key>APIKey</key>
        <string>**key generated**</string>
        <key>Kits</key>
        <array>
            <dict>
                <key>KitInfo</key>
                <dict/>
                <key>KitName</key>
                <string>Crashlytics</string>
            </dict>
        </array>
    </dict>

Now: I removed it

then in Build Phases Run script "${PODS_ROOT}/Fabric/run"

I left "${PODS_ROOT}/Fabric/run", removed both keys

in Input files section, I added : $(BUILT_PRODUCTS_DIR)/GoogleService-Info.plist (I use Xcode 11.3)

So when I try to run the project it builds successfully but crashes at [FIRApp configure]; this step. I suppose I am missing smth

Screen Shot 2020-01-01 at 23 13 06

and I am still on this step inside Firebase console Please help or give an advice whats wrong Thanks in advance

morganchen12 commented 4 years ago

Hm, you should be able to remove the GoogleService-Info.plist file from your run script's input files. Note that the GoogleService-Info.plist should still be added to your build target. You can also try updating your Crashlytics version, though this shouldn't be the cause of the crash.

Can you share the exception message printed to console when the app crashes?

MelanyG commented 4 years ago

2020-01-02 20:55:48.030008+0200 ProjectNameSwift[5913:9464199] Terminating app due to uncaught exception 'FABException', reason: '[Fabric] Value of Info.plist key "Fabric" must be a NSDictionary.' First throw call stack: ( 0 CoreFoundation 0x00007fff23c7127e exceptionPreprocess + 350 1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48 2 CoreFoundation 0x00007fff23c710bc +[NSException raise:format:] + 188 3 ProjectNameSwift 0x000000010076cb13 -[Fabric validFabricConfigFromInfoPlist:] + 334 4 ProjectNameSwift 0x000000010076c6f4 -[Fabric fabricConfig] + 127 5 ProjectNameSwift 0x000000010076c841 -[Fabric APIKey] + 285 6 ProjectNameSwift 0x000000010076b589 15+[Fabric with:]_block_invoke + 89 7 libdispatch.dylib 0x0000000103766d48 _dispatch_client_callout + 8 8 libdispatch.dylib 0x0000000103768297 _dispatch_once_callout + 66 9 ProjectNameSwift 0x000000010076b52a +[Fabric with:] + 233 10 ProjectNameSwift 0x000000010061798d $s15ProjectNameSwift11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0k6LaunchJ3KeyaypGSgtF + 381 11 ProjectNameSwift 0x0000000100618414 $s15ProjectNameSwift11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0k6LaunchJ3KeyaypGSgtFTo + 212 12 UIKitCore 0x00007fff48089ad8 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 232 13 UIKitCore 0x00007fff4808b460 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3980 14 UIKitCore 0x00007fff48090f05 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1226 15 UIKitCore 0x00007fff477c576d -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122 16 UIKitCore 0x00007fff47cb44c1 _UIScenePerformActionsWithLifecycleActionMask + 83 17 UIKitCore 0x00007fff477c627f 101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198 18 UIKitCore 0x00007fff477c5c8e -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 296 19 UIKitCore 0x00007fff477c60ac -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 818 20 UIKitCore 0x00007fff477c5941 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345 21 UIKitCore 0x00007fff477c9f3f 186-[_UIWindowSceneSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2 + 178 22 UIKitCore 0x00007fff47bd8c83 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 865 23 UIKitCore 0x00007fff47cd2dff _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 240 24 UIKitCore 0x00007fff477c9c5a 186-[_UIWindowSceneSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 153 25 UIKitCore 0x00007fff47cd2d02 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 84 26 UIKitCore 0x00007fff477c9ac8 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 381 27 UIKitCore 0x00007fff476206e7 64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 657 28 UIKitCore 0x00007fff4761f26c -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 248 29 UIKitCore 0x00007fff47620411 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 210 30 UIKitCore 0x00007fff4808f599 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 535 31 UIKitCore 0x00007fff47bfa7f5 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361 32 FrontBoardServices 0x00007fff365d6165 -[SSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 442 33 FrontBoardServices 0x00007fff365fc4d8 86-[SWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154 + 102 34 FrontBoardServices 0x00007fff365e0c45 -[SWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 220 35 FrontBoardServices 0x00007fff365fc169 86-[SWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 355 36 libdispatch.dylib 0x0000000103766d48 _dispatch_client_callout + 8 37 libdispatch.dylib 0x0000000103769cb9 _dispatch_block_invoke_direct + 300 38 FrontBoardServices 0x00007fff3662237e SSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 30 39 FrontBoardServices 0x00007fff3662206c -[SSerialQueue _queue_performNextIfPossible] + 441 40 FrontBoardServices 0x00007fff3662257b -[SSerialQueue _performNextFromRunLoopSource] + 22 41 CoreFoundation 0x00007fff23bd4471 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 42 CoreFoundation 0x00007fff23bd439c CFRunLoopDoSource0 + 76 43 CoreFoundation 0x00007fff23bd3b74 CFRunLoopDoSources0 + 180 44 CoreFoundation 0x00007fff23bce87f __CFRunLoopRun + 1263 45 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438 46 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65 47 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621 48 ProjectNameSwift 0x000000010061aa7b main + 75 49 libdyld.dylib 0x00007fff5227ec25 start + 1 50 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

MelanyG commented 4 years ago
Screen Shot 2020-01-02 at 21 02 33

So I have to remove GoogleService-Info.plist from the list of input files?

MelanyG commented 4 years ago

and yes GoogleService-Info.plist is added to my build targets

Screen Shot 2020-01-02 at 21 05 39
kevinkokomani commented 4 years ago

Hi there, I'm from the Crashlytics team. I believe this issue is coming from a misconfiguration of the Fabric API key while migrating.

In general, if you're migrating an app on Fabric Crashlytics to Firebase, the only thing you need to do is to follow the instructions at https://fabric.io/firebase_migration. This requires you only to click through a few screens in order to set up a Firebase app with Crashlytics already configured. Once this is done, you'll be linked to your Firebase console with all your existing Crashlytics crash reports there already.

Specifically, it looks like your issue happened when you "added GoogleService-Info.plist to the project," and also "removed the Info.plist." I'd recommend you roll back your changes to the last version of your app when it worked with Fabric Crashlytics only, and then follow the instructions on the migration webpage to get situated in Firebase.

So in general, if you are a Fabric user who is looking to migrate to Firebase, the steps are:

  1. Make sure to keep all previous Fabric dependencies and configuration instructions you followed when first onboarding Fabric Crashlytics onto your app
  2. Follow https://fabric.io/firebase_migration
  3. Confirm that clicking on the Crashlytics tab for that app on the Firebase console shows Crashlytics configured with your previous crash data
  4. Don't remove previous Fabric dependencies such as the API key
  5. If you're planning to use other Firebase SDKs/products, only then will you have to add the GoogleServices-Info.plist file.

Let me know if this helps!

google-oss-bot commented 4 years ago

I found a few problems with this issue:

MelanyG commented 4 years ago

Thank you very much for clear explanation, we decided not to migrate but start from stretch with Crashlitics and Firebase

rizafran commented 4 years ago

Hi. I'm going to close this issue since there's no action needed from us. If you're still experiencing this issue and want to continue the discussion, feel free to leave a comment here and we're happy to re-open this. Thanks.