Crashlytics file not found

XcodeCrashlytics

Xcode Problem Overview


Recently opened a project that I had compiled and submitted to Apple.

I haven't touched it for a couple of months but I'm getting this odd compile error at:

#import <Crashlytics/Crashlytics.h>

The error reads:

'Crashlytics/Crashlytics.h' file not found

Clearly the framework can't be found but I'm puzzled as to why, when the project was working a few months ago, it's suddenly stopped.

Any suggestions why?

Xcode: 4.6.3 Mac OS X: 10.8.4

Xcode Solutions


Solution 1 - Xcode

Just add $(SRCROOT) to the Framework Search Paths in Project Build Settings (Search Paths).

Crashlytics installation process drops its Crashlytics.framework to your project folder (or creates the symlink).

If you moved Crashlytics.framework somewhere deeper in the project folder hierarchy - set 'recursive' to the right or just point directly to its parent folder in Header Search Paths:

$(SRCROOT)/Path/to/the/folder/containing/Crashlytics.framework

Solution 2 - Xcode

Delete frameworks from you project and disk. Check that you have the newest version of Fabric plugin.

Copy frameworks from plugin folder to desktop with this commands:

ditto -xk ~/Library/Caches/com.crashlytics.mac/5b91b14e832a7b1c29441ec5ba109810/sdks/ios/com.twitter.crashlytics.ios-default.zip ~/Desktop/

ditto -xk ~/Library/Caches/com.crashlytics.mac/5b91b14e832a7b1c29441ec5ba109810/sdks/ios/io.fabric.sdk.ios-default.zip ~/Desktop/

Add frameworks from desktop to your project.

Info from: https://twittercommunity.com/t/error-upgrading-from-crashlytics-on-ios/36196/2

Solution 3 - Xcode

I'd recommend just using CocoaPods to add the Crashlytics framework. No need to care about paths anymore.

Podfile:

pod 'Crashlytics', '~> 3.4.1'

Script Build Phase for dSYM Upload:

./Pods/Crashlytics/iOS/Crashlytics.framework/run <your_crashlytics_id>

Import:

#import <Crashlytics/Crashlytics.h>

Solution 4 - Xcode

For me, this worked:

Remove the fabric and crashlytics frameworks from your project, and delete the files from the disk for our project.

Comment the lines in your appdelegate.m file, if you added them for the following:

import Fabric/Fabric.h
import Crashlytics/Crashlytics.h

and

[Fabric with:@[CrashlyticsKit]];

In the fabric app, choose "New app", and select your Xcode project file

Recopy the build script and build as instructed. The build step is why you needed to comment the lines above-- it won't work if you leave those lines in.

After the build script runs, it will prompt you to drag the frameworks from the app window into your project navigator. This will copy the latest versions of he frameworks (which include the .h files) into your project

I have tried manually downloading, and copying from other projects, but this is the only way I could recover after losing the frameworks files for an app.

Solution 5 - Xcode

In my case, the Framework was in the project folder, but not in the Project Navigator. I dragged it to the project and everything worked fine.

Solution 6 - Xcode

I've had this issue working with distributed teams (through github) after checking in then checking out Crashlytics. The Crashlytics.framework will only have one folder inside it -- "Versions". You need to save a version of the contents inside Crashlytics.framework to another location, then copy-paste them into Crashlytics.framework later.

Solution 7 - Xcode

Remove Crashlytics.framework from the project and disk. Copy and add it again. It helped me.

Solution 8 - Xcode

In my case, I was migrating from an old Crashlytics install through the Mac app to Cocoapods. A lot of the answers to this question recommend completely removing everything and starting over. I started doing this and noticed a discrepancy between code found in Fabric's documentation and the code shown in the Fabric app during the step where it tells you what to copy into your Run Script Build Phase.

Fabric's documentation has double quotes surrounding the entire string: "${PODS_ROOT}/Fabric/Fabric.framework/run <Your_API_Key> <Your_Build_Secret>"

The Fabric App only had double quotes around the path to the run executable: "${PODS_ROOT}/Fabric/Fabric.framework/run" <Your_API_Key> <Your_Build_Secret>

So before you delete everything and start over, try updating your Run Script Build Phase to this:

"${PODS_ROOT}/Fabric/Fabric.framework/run" <Your_API_Key> <Your_Build_Secret>

Solution 9 - Xcode

I have changed the name of the working folder and Craslytics fails. Check this in Build Settings (Search Paths).

Good luck!

Solution 10 - Xcode

I have tried to play with the frameworks search path and relocating & reconnecting the framework file; checked the build settings (Link binary with libraries section) but the error persisted.

Finally, I have reinstalled the framework, which only takes 2-3 minutes. The problem might be caused by that you have relocated the Crashlytics.framework to another subfolder from the root directory, but I am not sure about the exact reason.

  • Delete everything regarding to the Crashlytics
  • Start crashlytics app, login and select your project
  • Add run script
  • Drag & drop the .framework file (I have kept it in the root folder)
  • Add the import and startWithAPIKey statements back

Solution 11 - Xcode

  1. Completely Remove the Crashlytics Frameworks on your proj include the shell script in App Build Phases Run Script.
  2. Reinstall the Fabric follow the guide,everything will be OK.

Solution 12 - Xcode

I had previously upgraded to Fabric and had no issues. A couple of days later, I reopened the same project and had the missing crashlytics.h file problem.

I couldn't simply reinstall from the plugin due to a non compiling project (I had so many CLS_LOG messages and references to the missing crashlytics.h file in my project, it would have taken a long time to remove them just to allow the build to work - refactor wouldn't work on CLS_LOG).

So instead, I deleted the crashlytics.framework from my project and did the following to reinstate it from the plug in directly:

  1. Download the Fabric plugin again and double click the zip file to unpack the Fabric application.

  2. Right click the Fabric icon and "Show Package Contents"

  3. Copy the Crashlytics.framework folder to your Desktop and then re-add it to your project via File -> Add Files to ....

If step 3 doesn't work for you, you can also add crashlytics.framework to your project folder on your computer directly, and then also add it into your project list via Xcode same as in step 3 but uncheck "Copy Items if Needed" as you already put the files there yourself.

My project then compiled and worked fine again.

In terms of a guess as to why the file went missing? Part of the upgrade process got me to delete the old frameworks and then run the scripts etc. from the plugin. I think what happened is later when I emptied my trash, that some references were lost. I also had the problem where I'd put Crashlytics into my .gitignore file so it disappeared out of ALL my projects every committed which wasn't great.

Hope this helps someone!

Solution 13 - Xcode

I have same error.
Please try pod update and fix it.
If FirebaseCrashlytics 9.0.0 installed , problem will be fixed.

stalling FirebaseCoreDiagnostics 9.0.0 (was 8.9.0)
Installing FirebaseCoreExtension (9.0.0)
Installing FirebaseCoreInternal (9.0.0)

//hrer
Installing FirebaseCrashlytics 9.0.0 (was 8.9.0)
Installing FirebaseFirestore 9.0.0 (was 8.9.1)
Installing FirebaseInstallations 9.0.0 (was 8.9.0)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSnowcrashView Question on Stackoverflow
Solution 1 - XcodeLukaszView Answer on Stackoverflow
Solution 2 - XcodeWez Sie TatoView Answer on Stackoverflow
Solution 3 - XcodefluidsonicView Answer on Stackoverflow
Solution 4 - XcodeNoelHunterView Answer on Stackoverflow
Solution 5 - XcodeLudaView Answer on Stackoverflow
Solution 6 - XcoderizzesView Answer on Stackoverflow
Solution 7 - XcodeDmitryView Answer on Stackoverflow
Solution 8 - Xcodedjibouti33View Answer on Stackoverflow
Solution 9 - XcodeFran FoxView Answer on Stackoverflow
Solution 10 - XcodeYunus Nedim MehelView Answer on Stackoverflow
Solution 11 - XcodeBill XieView Answer on Stackoverflow
Solution 12 - XcodeinstAustraliaView Answer on Stackoverflow
Solution 13 - XcodeHideyasu.TView Answer on Stackoverflow