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

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)

Related

An error occured during export, Codesign failed , XCode 8.2.1

AnyOne has an idea how to solve this ?
PS : My project Settings are all verified.
Thanks.
Open finder--> press option Go - > Go to Folder
type your project path in that like :
Library/Developer/Xcode/DerivedData/yourprojectname/Build/Products/Debug-iphoneos
Now new window opens with list of Files, There you see yourApp.app file.
Now,
Open Terminal and type just cd then just drag yourApp.app (from finder window) to terminal, now you will get the path for the app, now press enter.
Now type command below:
xattr -rc .
Don't forget "."(Dot) at last.
Press enter button.
Now, Go to your Xcode project and clean and run again.
EDIT:
it is all about path miss match and cached path that you used before. so while doing above steps you are clearing build path for the project, that will make xcode project to run as new without taking cache.
making copy of the project and running same project with xcode make issue or keeping project in icloud and running from that location also makes issue.
May this help.
i just changed codeSign -> Release to iOS distribution then i put it back to iOS developer then i did a simple clean.
And that solved my problem (find it quite strange !!!).

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)

Swift 2 - Xcode 7 - failed with exit code 1

i have this error when i want to build my iOS App in Swift 2 and Xcode 7.0, i tried pretty much everything (clean, rebuild, delete derived date, ..)even re-install xcode but nothing has worked...
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
Thanks!!
RESOLVED:
I re-import all my files and my framework then the issue has disappear.
Try to delete manually DerivedData folder and restart Xcode
Users/%User%/Library/Developer/Xcode/DerivedData
Try Clean and rebuild, also delete derived data too.
Delete DerivedData folder from window -> projects -> select delete on DerivedData
Clean Your Project.
Rebuild

Can't get rid of Apple LLVM 5.0 Error

It keeps saying:
fatal error: file '/Applications/Xcode5-DP5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/objc/NSObject.h'
has been modified since the precompiled header
'/Users/jackiexu/Library/Developer/Xcode/DerivedData/ModuleCache/2MWVPCGUMQ29P/ObjectiveC.pcm' was built
note: after modifying system headers, please delete the module cache at '/Users/jackiexu/Library/Developer/Xcode/DerivedData/ModuleCache/2MWVPCGUMQ29P'
1 error generated.
I must have deleted the derived data at least five times by now, and I'm getting nowhere. Any ideas?
Open a terminal and type in :
rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache/*
Clean your project and build again. Worked for me.
Delete the folder, clean the app, restart Xcode if necessary.
as per xcode 5.
click on Xcode preferences
Goto locations tab
click on the derived data path which navigates to the folder called DerivedData
Delete the whole folder and restart xcode.
This works fine for me.
Happy coding :)
Have you tried reinstalling xcode? And have you cleaned using cmd+shift+k ?
The same thing was occuring to me. The warning was telling me:
After modifying system headers, please delete the module cache at
'/Users/yunus.mehel/Library/Developer/Xcode/DerivedData/ModuleCache/13XL2DHZVON89'
So, I have restarted xcode, deleted derived data from Organizer, deleted derived data from the derivedData folder; none of them worked. Then I have realized, the solution was already there; go to:
"DerivedData/ModuleCache/13XL6DH2BON89"
and delete that folder, not the "DerivedData/<your_project>". Make a clean build, it will work again.
Run this script to delete all relevant files in /Library/Developer/Xcode/DerivedData and /var/folders:
# run with
# ruby reallyCleanXcode.rb
derivedDataFolder = Dir.glob(Dir.home + "/Library/Developer/Xcode/DerivedData/*")
moduleCache = Dir.glob("/var/folders/**/com.apple.DeveloperTools*")
FileUtils.rm_rf derivedDataFolder + moduleCache
This happen when compiling, when running the app or neither?
Have you tried this:
Build Settings - Build Locations - Precompiled Header Cache Path -- there's a folder... delete it.
I solved this by:
Quit restart Xcode + clean project + clean build folders + clean derived data + deleted the /var/folders/.../.../C/com.apple.DeveloperTools/5.0.2-5A3005/Xcode/SharedPrecompiledHeaders + unplugged my iPhone
Rebuild and works :)
I was having the same problem. I did SHFT+CMD+K and tried to run,again the error appeared. My error pointed to the NSJSONSerialization header file. So what I did is deleted the files in ModuleCache and the project seems working now. I had changed my code which used NSJSonSerialization thinking it to be wrong, and project started working with the code also :)
To delete the files -- Click on 'Go' in the Desktop and then 'Go to folder' then type the folder path (Eg : 'Library/.…./ModuleCache') and delete all the files.
Regards,
ASK
Please follow below steps to get rid from your problem.
"Library/Developer/Xcode/DerivedData/ModuleCache/"
Delete all Folders inside ModuleCache Folder.
Make a clean build, quit Xcode and run it again
sure ,it will work fine.
Good Luck !!!
my solution,
in terminal, run command:
rm -rf /Users/jackiexu/Library/Developer/Xcode/DerivedData/ModuleCache/2MWVPCGUMQ29P
then in xcode, clean
then restart xcode and build
In addition to all of the other "clean your build" answers, nothing was working for me until I emptied out the (highly undocumented!) /var/folders directory.
Apparently, this is a "miscellaneous caches" dir maintained by OS-X. I didn't even bother figuring out what were "the correct files"; I just cleaned out the entire directory.
...And now I can build again. Hooray! From terminal:
[sudo] rm -rf /var/folders/*
(Although I did it from Finder, via authentication.) (OS-X 10.9.latest)
Additional clue: I could build with XCode-6-beta, but got the goofy corrupt error in XCode-5.
I used Shift + CMD + K to try and clean the project, but it did not disappear.
All I had to do was go and check the names of <yourProjectName>-info.plist and <yourProjectName>-Prefix.pch.
Then Shift + CMD + K worked.
In my case the problem was Clang exiting with code 1.
I was facing the same issue. I first cleaned the project do this by hitting "shift + command + k" and just rebuilt the project and it worked for me. hit "command + B" to rebuilt your project

RestKit Derived Data Troubles

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

Resources