Use Crashlytics with Carthage

Usually, developers integrate Crashlytics into their apps in order to track crashes of their apps. Regarding the integration, Crashlytics (or the company Fabric which stands behind Crashlytics) recommends using the dependency manager Cocoa Pods. The approach how to integrate Crashlytics into Cocoa Pods is described here in great detail. Due to a row of shortcomings in Cocoa Pods, a fair amount of developers prefers using the dependency manager Carthage. However, so far the explicit steps on how to integrate Crashlytics into Carthage remain vague. In the following I want to explain the explicit steps that worked for me.

The first step is to integrate the binary definitions into your Carthage file (as described here):

binary ""
binary ""
binary ""

Run carthage update afterwards. Please note that you should use the newest version of Carthage. I did not at first try, which resulted in an error on the command line. However, after updating Carthage it worked fine.

Drop the Crashlytics.framework and the Fabric.framework into your Xcode project. Please note, that you do not have to add the frameworks to the /usr/local/bin/carthage copy-frameworks Run Script phase.

The next step is to adapt the Run Script phase that initializes Crashlytics from the Cocoa Pods world to the Carthage world. For me, the following worked fine:

(Cut and paste: "${PROJECT_DIR}/Carthage/Build/iOS/Fabric.framework/run" <FABRIC_API_KEY> <BUILD_SECRET>. It goes without saying that you have to insert your own Fabric key and Build Secret.)

Afterwards add the Crashlytics information to your App’s plist file (as described here):

Finally, add Crashlytics and Fabric to your AppDelegate (as described here also):

I hope that works for you as well. Please drop me a comment if you have questions or suggestions for improvement.