domi852
domi852

Reputation: 527

Firebase Crashlytics with Swift Package Manager - crash because of wrong path

I have installed Firebase through the Swift Package Manager for my iOS project, including Crashlytics. I have followed these instructions and added the required script to build phases: https://firebase.google.com/docs/crashlytics/get-started?platform=ios

So the path for execution is: "${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"

On start up (iPhone simulator), the app crashes with 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.

I checked the derived data folder and followed the path. Indeed, the Crashlytics run script is at the expected path.

thanks for any hints in the right direction

Upvotes: 1

Views: 1155

Answers (2)

mswlogo
mswlogo

Reputation: 149

I pulled my hair out trying to fix this and came up with

"${SDK_STAT_CACHE_DIR}"/*/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run

SDK_STAT_CACHE_DIR is your DerivedData folder. The wild card has to be outside the quotes so it gets resolved by the file system. It is your particular project with the ugly generated name. Strange I couldn't find a symbol for that but it is buried in a lot of large path variables.

Now if you have two projects with the same thing not sure which you'll get :)

p.s. I don't get a crash. It just fails to build because it fails on the dSym upload script.

Upvotes: 0

domi852
domi852

Reputation: 527

In the meantime I've found out that the path to the build folder is set globally in the Xcode preferences. For some reason I don't recall, my build folder has always been in my project folder for all projects I ever worked on in Xcode... I know this for sure because I always add the build folder to .gitignore. To change the build folder to be a subfolder of your project's derived data folder, go to: Xcode -> Preferences -> Locations -> Advanced and select the first option. Firebase assumes that this option is selected by default (maybe it is and I'm the weirdo...). enter image description here

Upvotes: 1

Related Questions