'Firebase Crashlytics | Swift Package Manager (SPM) Run Script?

I want to add Crashlytics to my app using the Swift package manager.

Now, since the usual way to install Firebase is through CocoaPods, the tutorial on how to set up Crashlytics properly is also adjusted for CocoaPods.

In other words - the run script we should copy from the tutorial is not compatible with SPM, as you can see here:

${PODS_ROOT}/FirebaseCrashlytics/run

So how can I find the file location of Crashlytics using SPM to get the correct run script?

Thanks!



Solution 1:[1]

And another quite important thing if a non-default name for the firebase configuration file is used. This flag is needed to denote it:

-gsp ${PROJECT_DIR}/PATH-TO-CONFIG/GoogleService-Info-Dev.plist

Thus final script should look like

${BUILD_DIR%Build/*}SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run -gsp ${PROJECT_DIR}/PATH-TO-CONFIG/GoogleService-Info-Dev.plist

Where PATH-TO-CONFIG is the path to the firebase configuration file in the project.

Solution 2:[2]

Thanks for the suggestions. I'm unable to make this work. I get a crash and the following error message:

/Users/[path-to-my-project]/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run: No such file or directory Command PhaseScriptExecution failed with a nonzero exit code

I don't understand why it tries to find the crashlytics script in my Xcode project folder and not in the derived data folder at runtime.

Solution 3:[3]

Add a package by selecting File ? Add Packages… in Xcode’s menu bar. enter image description here

Search for the Firebase Apple SDK using the repo's URL:

https://github.com/firebase/firebase-ios-sdk.git

Next, set the Dependency Rule to be Up to Next Major Version and specify 8.10.0 as the lower bound.

Then, select Add Package.

Choose the Firebase products that you want installed in your app.

enter image description here

If you've installed FirebaseAnalytics, add the -ObjC option to Other Linker Flags in the Build Settings tab.

enter image description here

Solution 4:[4]

This worked for me, but I had to change Project Settings.

"${BUILD_DIR%Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"

enter image description here

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 domi852
Solution 3 Fatemeh
Solution 4 Jules