Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 499
Mofawaw Avatar asked Dec 22 '20 14:12

Mofawaw


3 Answers

Turns out its inside the DerivedData folder:

~/Library/Developer/Xcode/DerivedData/YOURAPP-.../SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run

For your convenience, you can use a build variable to generalize the folder path:

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

Finally, your run script should look something like that:

like image 72
Mofawaw Avatar answered Nov 15 '22 18:11

Mofawaw


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.

like image 21
Dren Avatar answered Nov 15 '22 18:11

Dren


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.

like image 28
domi852 Avatar answered Nov 15 '22 17:11

domi852