RestKit Derived Data Troubles - ios

I'm trying to get going with Restkit. I've followed the install instructions here: https://github.com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x
I'm running Xcode 4.3.2. When I try to run the RKCatalog project, I get an error: clang: error: no such file or directory: '/Users/sparky/Library/Developer/Xcode/DerivedData/RKCatalog-fdohdnazcupmydfaxxedezitkbpl/Build/Products/Debug-iphonesimulator/RestKit/RestKit'
I'm not an Xcode expert. I'm not sure where to go from here.

If you have Restkit.framework added in the libraries in "Build Phases" (Targets > Build Phases > Link Binary With Libraries) you have to remove it. I learnt from one of the discussions on GitHub that Restkit.framework is for Mac OSX and libRestKit.a is for iOS.

I had a similar issue with my project. What worked for me was to delete all reference to my project on the DerivedData folder. So, in your case:
rm -rf /Users/sparky/Library/Developer/Xcode/DerivedData/RKCatalog-*
After this, try restarting XCode.

You can easily clear Xcode's derived data folder using the keyboard shortcut:
⌘ + option + shift + k

Related

Auto-Linking framework not found

I have forked a framework called BTNavigationDropdownMenu (swift project for ios). all worked fine till I tried to add a dependency to the latest version in the branch I created. the problem is the same whether I add the other framework (DYBadge) through a podfile or through Carthage.
Auto-Linking framework not found DYBadge.
It seems to have a problem with a UIView extension that is part of DYBadge.
DYBadge works fine in my main app I'm working on (I also need it in the app target).
errors below. thanks for any hints into the right direction.
ld: warning: Auto-Linking framework not found DYBadge Undefined
symbols for architecture x86_64: "(extension in
DYBadge):__ObjC.UIView.getBadge() -> DYBadge.DYBadge?", referenced
from:
Demo.BTNavigationDropdownMenu.updateBadge(text: Swift.String, at: Swift.Int) -> () in BTNavigationDropdownMenu.o ld: symbol(s) not
found for architecture x86_64 clang: error: linker command failed with
exit code 1 (use -v to see invocation)
Xcode is not able to find your frameworks because the FRAMEWORK_SEARCH_PATHS is probably not set or is wrong (happened to me because I moved the Info.plist file).
You can fix this by going into your target and adapt the Build Settings. Simply search in there for FRAMEWORK_SEARCH_PATHS and add the correct one, which is usually $(PROJECT_DIR)/Carthage/Build/iOS (for iOS projects). $(inherited) should also be in there as the first entry.
This is the post of #user3122959 answer in the comments, which helped me and others to fix this problem and was requested to put in as the answer to this question.
Try this process -
Press "Cmd + Shift + K" or shift + cmd + alt + k to clean up, and quit Xcode.
Delete the cache Run "rm -rf ~/Library/Developer/Xcode/DerivedData" in terminal
Open the project and re-build it
I had this problem accessing 3rd party frameworks from my tests. Here's how I fixed it.
In Xcode goto: Your Unit-Test target > Build Phases > Link Binary With Libraries
In Finder goto: Carthage > Build > yourframework.Framework
Drag the framework in to your build phases then clean (cmd - shift - K).
This can also be an error if you use a framework that has Bitcode Enabled on false.
Bitcode Enabled can only be true if all frameworks also have Bitcode enabled true.
Go to your targets build settings and disable bitcode.
For me this fixed it:
Go to Project > Targets > Build Settings (Tab) > Build Options (Heading)
Set Enable Testing Search Paths to Yes.
Instantly back up and running. Honestly not sure what this means but it worked.
If you are using Carthage and several Projects within one Workspace you have to add a symlink to your Main Carthage Folder. it will depend what structure you have, but for example if you have
Project -> Carthage
Project -> Frameworks -> MyImbaFramework than cd in terminal in MyImbaFramework folder and run
ln -s ../../Carthage Carthage
In my case, there was an issue with Bitcode, but Xcode couldn't give an accurate error diagnostic since the project framework references were also somehow messed up. Running the framework tests worked fine, but archiving gave the auto-linking error.
Deleted all framework references from the project, including the Frameworks group they were under, added them back again resolved the references issue, then I got the bitcode issue, which I disabled on the target framework, then and only then, archiving was successful
I had a similar error and none of the suggestions on this page worked. It occurred when trying to create an archive when pointing to my test iPhone, when I changed it to 'Any iOS Device' it worked correctly. I suspect this is related to the recent change to add support for Apple Silicon but I'm not certain how.
Make sure you haven't set a testfile that imports XCTest's TargetMembership to the main target, but to a test target :-)
Hope this helps someone, this is what worked for me
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf Pods
rm Podfile.lock
pod cache clean --all
pod install --repo-update
and cleaning the build folder
XCode > Product > Clean Build Folder
or
⌘ Command + ⇧ Shift + K
then closing XCode an clearing the derived data again
rm -rf ~/Library/Developer/Xcode/DerivedData
For me, the problem was that I had set the "Other Linker Flags" setting prior to converting my project to use Cocoapods. To fix this, I changed that field to use $(inhereted) and everything worked after that.

dyld: Library not loaded: #rpath/libswiftAVFoundation.dylib Reason: image not found

I'm getting this error upon launch of my app. I am building under Xcode 9.0 (9A235) on MacOS High Sierra 10.13. I also tried building under Xcode 8.3.3 with the same result. The project is generally Objective C, but the framework YouAppi.framework is Swift:
dyld: Library not loaded: #rpath/libswiftAVFoundation.dylib
Referenced from: /private/var/containers/Bundle/Application/7D3E2815-4CA3-4258-AEF6-C0626055A8F2/dingbats.app/Frameworks/YouAppi.framework/YouAppi
Reason: image not found
At first glance, this appears to be a duplicate of this question, but the error is different in that one. In that other question, the Reason is no suitable image found, where mine is image not found.
I've tried the following to resolve:
Remove and re-add the framework
Clean and Option+Clean the project
Delete ~/Library/Developer/Xcode/DerivedData folder
Build Settings -> Always Embed Swift Standard Libraries = Yes
Build Settings -> Strip Swift Symbols = No
Build Settings -> Linking -> Runpath Search Paths --
added #loader_path
added #rpath
added #executable_path/Frameworks
Checked developer and distribution certificates that Trust was set to Use System Defaults
Checked that I have latest WWDR and G2 certificates installed
Checked validity of above-mentioned certificates
Moved YouAppi.framework into Frameworks/ folder. (It was originally in a "Third-Party Frameworks" folder.)
Tried copying libswiftAVFoundation.dylib into my project's Frameworks folder
I haven't moved to a new computer recently.
I have the same result on my iPhone 7+ running iOS 11.0.23 (15A432) as well as an iPad Mini 1 running iOS 9.3.5 (13G36).
Also tried this:
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~/Library/Caches/com.apple.dt.Xcode
Ideas?
When including a framework built with Swift in a non-Swift project, the Swift standard libraries need to be copied into the final output. Xcode has a checkbox for this (#4 in the original question), but apparently there's a bug where, in some cases, it doesn't actually happen.
I saw another thread somewhere that said this happens when you have a framework built with Swift, which is built for multiple architectures, such as armv7 and arm64. (See the thread here.)
In any case, the solution is to add them all manually. The files you are looking for are in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos.
What I did was this:
Step 1. Open Terminal and type this, copying the libraries to a new folder, swiftStdLib, in your home directory.
cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos
mkdir ~/swiftStdLib
cp libswift*.dylib ~/swiftStdLib
Step 2. Within Xcode, go to General -> Embedded Binaries, and hit the + to add. Click Add Other, then navigate to your home folder/swiftStdLib. Select all and hit enter.
Step 3. Clean and build the project.
Hope this helps someone.
UPDATE FOR XCODE 11:
In Xcode 11.3, the Swift libraries folder has changed to include the major Swift version number. The original question was based on Xcode 9, so this probably changed earlier than Xcode 11.3, but I haven't checked.
The new folder is /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos.
So that makes Step 1, above, this instead:
cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos
mkdir ~/swiftStdLib
cp libswift*.dylib ~/swiftStdLib
Before adding frameworks try this:
I deleted derived data in xcode9 - it works for me
refer link below: How to delete contents from derived data
How can I delete derived data in Xcode 9?
Deleting old developer certificates from Keychain Access helped for me.
Just cleaning the project sometimes seems to work for me. I have noticed this happen more frequently when I have a swfit/objc/c++ project combination.
Simple step to follow
Project -> Build Phases -> Embed Frameworks -> +.
It will works for all.. Perfect solution for everyone.
Add library in Link Binary with Libraries &
Add new Copy Files Phrase, Select framework in destination section and import library there.
And Run your code.. Magic.. Enjoy
NOTE:-Please make sure "Copy only when installing" in Copy files is unchecked

Apple Mach-O Linker & Ditto Error - Xcode 8

I have just updated my Xcode to Xcode 8 and am now trying to convert my project's code to Swift 2.3. I was able to build a couple times using Xcode 8 without any errors. Now, the following errors came up:
Error #1: Apple Mach-O Linker Error: Linker command failed with exit code 1
ld: file not found: /Users/Linus/Library/Developer/Xcode/DerivedData/MyApp-asdjeshhsetnfxbegcsbcipdreneewgr/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/DownloadsViewController.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I don't even know what a .o file is. The swift file of DownloadsViewController is there, though.
Error #2: Ditto Error: Command /usr/cin/ditto failed with exit code 1
ditto: can't get real path for source '/Users/Linus/Library/Developer/Xcode/DerivedData/MyApp-asdjeshhsetnfxbbciegrfdpdreneewgr/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp-Swift.h'
Command /usr/bin/ditto failed with exit code 1
The ditto error occurs 3 times: for MyApp.swiftdoc, MyApp.swiftmodule, and MyApp-Swift.h.
Thanks in advance!
Quit Xcode
Restart the System
Select Xcode -> Preferences.
This will open a pop-up window. Select 'Locations'. In Locations, you will see 'Derived Data'. Click on the arrow icon right next to the path.
This will open a folder containing 'Derived Data', delete it.
Clean the Product and Run
Make sure you open the project from the .xcworkspace file instead of the .xcodeproj
step 1 = clicking on the project in the navigation menu
step 2 = select the project
step 3 = build settings
step 4 = search enable bitcode if bitcode is yes than change to No
None of the previous answer have solve my problem.
I think it come from changes in the cocoapods podFile, from using frameworks to not using them
Frameworks was still remind in Target>General Properties>Linked Frameworks. I removed them
I also remove the -framework and corresponding frameworks from other linker flags (saving inherited and objC flags)
Hope that could help
This happened to me after I delete my app while it was running.
I solved it cleaning the project.
Product > Clean or Shift + Command + K
This is because at some point some project file was not compiled. In my case the AppDelegate.swift was not in the compiler. So I added it manually and it worked.
Clean XCode with following cmds and rebuild:
rm -rf ~/Library/Developer/Xcode/DerivedData/
killall Xcode 2> /dev/null
killall Instruments 2> /dev/null
killall 'iOS Simulator' 2> /dev/null
killall Simulator 2> /dev/null
killall 'Simulator (Watch)' 2> /dev/null
killall ibtoold 2> /dev/null
killall simctl 2> /dev/null
# There may be others
# Kill the service itself
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
rm -rf ~/Library/*/CoreSimulator
For my react native app, I deleted a folder of a test project inProject Navigator and Targets. It solved my problem.
Don't wory ,just go to your project targat and then build setting and search enable bitcode change it to YES to NO.
Turning Bitcode to "No" solved this issue. This is found in the Build Settings.
I had the same problem when I changed Xcode from a previous version 7 to the new XCode 8. In the new Xcode (8.3.3 now) there are more settings in the compiler.
When you update the project settings into new Xcode (using Editor->Validate Settings), these new settings are applied and set to the default value YES. After this update I had the linker error!
In my project I compared the previous version of the file .pbxproj with the new one (after Settings validation) using Beyond compare (or similar).
In this way I can saw the new settings added in the new version of Xcode and I set the new Settings value to NO. After this update all was OK and the linker error disappear.
If you're importing a framework through Build Phases, try to put it inside the folder of your project and add it into Link Binary with libraries. Actually, I've already experienced that problem before, I am very frustrated with that error until I knew that I have to put the .framework inside the folder of my project.
Hope will help
On top of cleaning derived data and the project and restarting xcode, I've found that re converting your project to current swift syntax and re installing pods if you have them also helps.
To re convert your project you will need to set swift_version build setting back to yes so that your target appears in the conversion list.
The issue I found with XCode 8.2.1 (Version 8C1002) after I converted the project to Current Swift Syntax (Swift 3). I just needed to rebuild it after cleaning, and the errors disappeared.
If the procedure of cleaning and the disabling of bitcode does not work, then it's possible that the reason for the errors simply is a more complex syntax error in your code.
I got the same problem because I had defined a class (using #interface), but did not provide an implementation (using #implementation) for it. It was a simple class so even an empty implementation resolved it.
Also just check if you are importing a "*.m" implementation file in any of your classes, that can cause the same issue.
Removing the import statement can fix the issue
For me it was a problem with react native haptic. I think it was because of a change in CocoaPods but also because of changing up file locations. I just removed it and re installed it. Hope this helps someone.
UPDATE
The build succeeded by when running it it would just crash. To solve this I used File > Add Files to Project for the GoogleService-Info.plist and it worked.
Please make sure you have following changes in Workspace setting in your xcode:
Please go to your workspace setting and make the following changes:
Workspace Setting:
Build System:
Legacy Build System
Per -User Workspace
DerivedData:
Workspace relative location
Build System
Use User Setting
Hope it helps:
Follow the below steps:
step1: Go to Build Phase Tab then only expand Link Binary with Library
step2: Then Go to General Tab then Expand Linked Framework & Library
(because Yourprojectname.framework is disable)

Cocoa: Command /usr/bin/ditto failed with exit code 1

I am trying to build my project but it is not getting build.
I am getting the following error:
Command /usr/bin/ditto failed with exit code 1
I have cleaned my project but still is issue is persisting.
Xcode Details:
EDIT Solution tried
I went to
~/Library/Developer/Xcode/DerivedData
and deleted everything inside the folder then went back to the Xcode and tried to build the solution. Getting the same error back
Command /usr/bin/ditto failed with exit code 1
clean your project and see whether it help or not
Command + Shift+ K
or
Product > Clean
Or check this link it may helps you: http://codica.pl/2015/12/25/taming-swift-compiler-bugs/
For Mac OS Sierra, this work for me:
cd /Users/YOUR_USER_NAME/Library/Developer/Xcode/DerivedData
then
xattr -dr com.apple.FinderInfo *
and then rebuild your project..
and fix the error!
All of sudden, It happens to my Mac app project today in Xcode 7.3.1.
What I did :
Clean >Clean build folder > Quit Xcode >Open Finder then go to
~/Library/Developer/Xcode/DerivedData
then deleated everything inside >Open Xcode >Build >Run
I think this is happening when something is wrong adding a file into Xcode.
I have not encountered since readding myApp.help file without the option 'Destination: Copy items if needed'.
Look at the error messages and find out which files are affected. Delete these files (remove references) and then add them again to your project's target. It should work now.
Follow this steps:
clear "Derived Data" from files.
Xcode >> Preferences >> Locations >> click on arrow icon(opened "DerivedData" folder)
remove/delete all files from "DerivedData" folder.
clean project(cmd + swift + k)

xcodebuild failure clang:error no such file or directory:

Having a problem when building with xcodebuild. My project/app builds fine with the Xcode - gui. It simply isn't finding/building the libcryptopp library which is part of the build process.
The error is:
clang: error: no such file or directory: '/Users/builder/repo/ioskpay/xcode-cryptopp/cryptopp/build/Release-iphoneos/libcryptopp.a'
This particular file should be derived from another project inside the main app - xcodebuild simply isn't correctly pointing at the right file folder which should be:
~/Library/Developer/Xcode/DerivedData
Any ideas?
To fix this, go to your project settings, go to Targets and select your main project target. Then go to Build phases. Under Target dependencies add the static library project.
This way, when you compile the main project, the static library subproject gets compiled before the main project and your static library will be available.
I had the same problem, but for a resource file .m
I opened target -> build phases -> Compile sources
and I found the file the compiler was tell it can't find duplicated: one with strange icon and the other with a normal icon. I simply removed the one with strange icon and it worked. ( I added the file multiple times and I had a merge conflict before that which made something wrong in the project file)
For your case I think you need to remove the lib from target dependencies list and add it again. This may work for you.
In Xcode Version 9.2 (9C40b) this happened when I drug a bunch of files into the project, some of which were duplicate. Rather than simply not adding the duplicates, it added them again and only the name, not the path.
In Target > Build Phases > Compile Sources each of the duplicates showed with no "...in" after them. Each one caused the clang error.
After removing all of the duplicates that Xcode collected, the project compiled and ran.
It makes you use the Project Navigator instead of managing your source files in the Finder. Then the Project Navigator can't replace duplicates like any decent file management system (ahem Finder). 🤨
My xCode info is:
I faced similar errors during xcode building projects (native swift, flutter, react native, native script) in which I got error messages related to clang compilar. Errors like:
clang-4.0: error: no such file or directory: '/Users/xxxxxxxx/Library/Developer/Xcode/DerivedData/xxxxxxxxxxxxxxx/Index/Data Store'
clang-4.0: error: cannot specify -o when generating multiple output files
others
Despite of errors related with DerivedData for native apps can be fixed by deleting the directory and, eventually, restart xCode and even restart the machine... in this case, you will see that after deleting the directory and start building process again, the error comes back.
Then, is the moment of checking the clang installation by running clang --version. The normal output will be something like:
as you can see the InstalledDir is incorrect for xCode. In my case, some days ago I needed to install Anaconda app (R, Python, etc) and, now, I remember that I had to install some dependencies and one of them was clang and its installation was altered.
To fix this problem (in my case that I will not need anaconda any more): (edited)
1.- Delete anaconda and all its dependencies (I recommend to use App Cleaner).
2.- Re-install xCode
After reinstalling xCode, if you type again clang --version, you'll get this:
More info at: https://github.com/flutter/flutter/issues/32457#issuecomment-496161092
Hopefully, this info helps some else.
Best
Ok so by simply adding the correct -target -configuration and -scheme parameters I got this to run correctly. However due to my running this in Jenkins for autobuild purposes it still doesn't work as I'd like - getting stuck in exactly the same place. It's odd because I have the exact same code being built in another job that isn't having this problem. There is no rhyme or reason for it at this point. I will keep shooting rubber bands at it and update when I have an answer...
Sometimes Xcode performs weird.
You have to find that static library project e.g.. "filename.a" under 'Link Binary With Libraries' in Build Phase and then remove it and add it again.
I had the same problem while I was archiving my target. I removed the library and the build succeeded.
For me it was because I had removed a package or pod. I ran pod install and it fixed it
Look for the missing file in the Xcode project i.e the files may be deleted or miss placed.
add the missing files to the xcode, then everything will work fine.
Run this command :
$ conda deactivate

Resources