Crashlytics file not found - xcode

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

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

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

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>

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.

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.

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.

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

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>

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

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

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

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:
Download the Fabric plugin again and double click the zip file to unpack the Fabric application.
Right click the Fabric icon and "Show Package Contents"
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!

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)

Related

Library not found for -lFolly

After updating react-native from version 0.63.2 to 0.66.1, i get the following error in Xcode when i try to build my app.
library not found for -lFolly
I've tried running pod install and cleaning the build folder.
My Library Search Paths look like this for both release and debug.
Delete libFolly.a file from Xcode>Targets>General and clean DerivedData, run again. Maybe you can face with other problems but if you don't use folly file in your pods it will work. I hope it works for you too.
I have been struggling with this issue. Finally this solution resolved the issue.
I had the two copies of files in the codebase. Deleting one copy helped code to build successfully
Source: https://stackoverflow.com/a/53417764/8364900
<project name>/ios/<project name>.xcworkspace/contents.xcworkspacedata
The above location may have reference to multiple copies of your project. If so delete one copy then run the project.

Cocoa Pods without workspace?

I have read about a possibility to add CocoaPods to an XcodeProject without getting the xcworkspace file, instead you get a xcodeproj file that you can integrate into your current project. How can I do that? Would love to use the xcodeproj file instead of xcworkspace.. I'm programming in swift (if that makes any difference).
Yes, its possible. But, we need to do few steps to proceed.
Check this Github thread.
The below line in pod.file will not let the client integration process.
install! 'cocoapods', :integrate_targets => false
We can drag and drop the Pods.xcodeproj to the main project
Link the target dependencies and Link Binary with Libraries in Build phases.
Thats it.
You can not do this.
The CocoaPods website guide to using CocoaPods found here directs you to using the .xcworkspace it creates. Several other guides found across the Internet all direct you to use this file indicating that using the .xcodeproj file will now result in build errors.
There is simply no evidence that this is a possibility at all.
From the CocoaPods website guide on using CocoaPods:
Save your Podfile.
Run $ pod install
Open the MyApp.xcworkspace that was created. This should be the file you use everyday to create your app.
More from their website:
Now you can install the dependencies in your project:
$ pod install
Make sure to always open the Xcode workspace instead of the project
file when building your project:
$ open App.xcworkspace
And from the Ray Wenderlich guide regarding using CocoaPods with Swift:
Open the project folder using Finder, and you’ll see that CocoaPods
created a new IceCreamShop.xcworkspace file and a Pods folder in which
to store all the project’s dependencies.
And from an NSHipster article on CocoaPods:
CocoaPods will create a new Xcode project that creates static library
targets for each dependency, and then links them all together into a
libPods.a target. This static library becomes a dependency for your
original application target. An xcworkspace file is created, and
should be used from that point onward. This allows the original
xcodeproj file to remain unchanged.
In older versions of cocoapods it was possible to install and update pods with the option '--no-integrate'. It allows you to create a library project, which could be imported into an existing project (read more). But this option is missing now. I've build a Xcode project for a maven-build with this option earlier. Today I've updated the pods of this project with the newest cocoapods version (1.0.0) but without the '--no-integrate' option and it still works. So eventually there is a way...

Why does Xcode use the old build path after moving a project's containing directory?

I have created a simple OSX Command Line App project with Xcode 6.3, called Foo, and set the location of Foo to ~/Desktop. Building and running the project is fine. To be clear, the project path is ~/Desktop/Foo/Foo.xcodeproj.
If I move the project's containing directory ~/Desktop/Foo to, say ~/Desktop/tmp/Foo, open ~/Desktop/tmp/Foo/Foo.xcodeproj, and then build the project, I see that Xcode creates ~/Desktop/Foo/build/ and so on. It seems that Xcode is still using the old build path rather than the build directory that is relative to the project (~/Desktop/tmp/Foo/build/).
Why is this? I am using a typical installation of Xcode and have not modified any configuration of Xcode nor the project or its build settings. Xcode 5 definitely did not behave this way.
Yes, the project has been cleaned.
I can only attribute this to accumulated cruft after installing, removing, and updating Xcode to various 6.x betas over the past year.
After deleting Xcode configuration via defaults delete com.apple.dt.Xcode, things are behaving as expected.

Sublime Text 3 overwrites manually installed package in OSX

Following instructions to manually install arduino IDE here
Reason for manual installation is because package manager has an older version of the plugin (10 months).
After placing it in ../Packages, I open ST3 and watch Finder. Initially, the folder extracted is named "Stino-new-stino". A folder is created at ../Packages/User/Stino with what seems to be options for the topmenu, and then the Stino-new-stino folder is deleted.
Tried to put extracted folder into ../Installed Packages, as well as ../Packages/User, but doesn't get detected.
Also noticed that my TomorrowTheme package got moved into my ../Packages/User/SublimeLinter.
I removed SublimeLinter and it still seems to be happening so I'm thinking it's an ST3 thing.
There was some funky beta code happening and had to remove package-metadata.json for it to stop deleting itself.

Fixing file 'project.pch' has been modified since the precompiled header was built error in Xcode

I was recently working on my application messing around in the info.plist section, and since that my application will not run on my test device:
file 'project.pch' has been modified since the precompiled header was built
Something to note is that the app runs fine in the simulator.
Edit: Now I am getting this error instead of the other one:
No such file or directory (/Users/Me/Library/Developer/Xcode/DerivedData/MyProject-abcdefghijklmnopqrstuvwxyz/Build/Products/Debug-iphoneos/MyApp./MyApp)
How to regenerate the info.plist file?
You could try a deep clean (not the same as Product > Clean) - Option+Command+Shift+K
Note: this means the clean the build folder (by pressing Option + Product -> clean folder)
Close your project or workspace.
In Finder: ⇧shift+⌘cmd+G
Paste: ~/Library/Developer/Xcode/DerivedData/
Delete the ModuleCache folder and empty trash.
Open up your project.
Clean: ⇧shift+⌘cmd+K
Build: ⌘cmd+B
In my case the error message had a small hint:
note: after modifying system headers, please delete the module cache
at
'~/Library/Developer/Xcode/DerivedData/ModuleCache/5CYAJ91AZCB7'
I tried and it worked.
Simply touching the project's pch file solved this issue it for me :
touch Test.pch
Product -> Clean
Product + Option -> Clean Build Folder
Close Project or Workspace
Clean 'ModuleCache' path in Finder.
Worked for me in Xcode6 GM and iOS 8.0.
When the .h file of a Library Provided with Xcode is changed (even a space), this error could occur.
The following maybe tried in order to fix this issue
In, Project -> Build Settings, change Precompile Prefix Header to NO
OR
Run rm -rf ~/Library/Developer/Xcode/DerivedData and Clean Build
I constantly had this since upgrading from Xcode 4.6 to Xcode 5 with iOS projects when using command line build (xcodebuild).
What worked for me is to use this as command line build command:
xcodebuild -project path/to/my.xcodeproj -configuration Debug clean build
Before this, I've tried:
Clean the project in Xcode GUI.
Delete the offending pch file.
Delete the offending pch file's parent folder.
Delete the DerivedData project folder.
None of the above worked for me under Xcode 5.0.2, Mavericks, iOS7.
Note that the problem didn't happen to me when using Xcode GUI.
I just go to directory "/$HOME/Library/Developer/Xcode/DerivedData/", delete everything there
Just Click Product from the menu and select Clean
Product>Clean
Worked fine for me.
I got the same problem. My error said like I need to delete the cache in the below locaition,
Users/myusername/Library/Developer/Xcode/DerivedData/ModuleCache/3FGETKFCU0N0W
3FGETKFCU0N0W was a folder, when I deleted it and then clean build the project. Then the error disappears.
rm -rf ~/Library/Developer/Xcode/DerivedData/
If you use AppCode you can try remove content form:
/Users/[Username]/Library/Caches/appCode30/DerivedData/
Worked for me :)
Also, just open terminal, and delete the .pcm file that has been generated (Xcode 6 onwards)
rm <path-to-pcm-file>
If you get this when switching between git branches, try adding this post-checkout hook which will clean your project every time you change branch.
!/bin/sh
xcodebuild clean -configuration Debug
Save as .git/hooks/post-checkout relative to your project root and don't forget chmod +x .git/hooks/post-checkout
For me, this problem is only occurring in Xcode 6 beta version, So I switch back to Xcode 5, and now problem is solved.
I tried all the steps suggested by all users here, but no one worked for me.
So, if you have both versions of Xcode and have issue only in Xcode 6 beta, then switch to Xcode 5 and clean the project, problem will be solved.
I tried these one by one but failed to build and run my project. So I changed Precompile Prefix Header to NO as mentioned by #Abhilash Gopal, then I reset the simulator,deleted the derived data, removed the corresponding .pcm file(In my case it was the UIImage.h from UIKit framework, so removed the UIKit.pcm).Then I cleaned the project and only then I was able to build it successfully. In earlier versions of Xcode these files were locked basically and were not allowed to edit. But its not the case now. Hope this helps someone who face the same situation.
The only solution there worked for me was running the following command:
sudo rm -R /var/folders/
But that gave me a lot of troubles in OS X.
I thought because /var/folders/ is for temporary files it should be okay to just empty anything in it.
But I was wrong see the following post: link
And the problem you described occurred every-time I tried to build my Xcode project - I'm building it from the CLI though Jenkins.
Which means I couldn't run the rm command every-time. So I found some inspirations and wrote the following ruby script which solved my problem:
#!/usr/bin/env ruby
require 'fileutils'
cache = Dir.glob("/var/folders/**/com.apple.DeveloperTools*")
FileUtils.rm_rf(cache)
I hope it would be helpful to someone.
Deleting project.xcworkspace did a trick for me.
project.xcworkspace is a directory which describes schema of current Xcode workspace state. Each time Xcode is launched it will regenerate project.xcworkspace if not exist already.
In order to delete project.xcworkspace:
Right click on your project file yourProject.xcodeproj
From drop-down menu choose Show Package Content
Purge xcworkspace file
If you are building on command line using xcodebuild remove '-parallelizeTargets' option passed to the command. That fixed the issue for me
After going through a lot of answers and helpful suggestions, I found out the solution to be: Uninstall Xcode 6 and reinstall it through the available dmg file and then install all the components for Xcode.
Product + Option -> Clean Build Folder, Clean Build Project, Deleting Module Cache files and Derived data files, using touch .pch, deleting pcm file, using command line to remove var/folders (Surprisingly, all of this did not help in my case)
Was stuck at it for more than 3 hours before finding the solution. Hope this helps someone.
Thanks.
Just open terminal and fire below command:
rm /Users/pratik/Library/Developer/Xcode/DerivedData/ModuleCache/LKL48GNAN6S7/UIKit-2X95M2Q1NPNPL.pcm
give your file path which return .pcm error. and then Clean Project and Run...Enjoy!!!

Resources