I am running low on disk space and checked through a third party utility that among other things that ~/Library/Developer/Xcode/DerivedData directory is taking about 22GB of disk space.
I searched stackoverflow and found this post
How can I safely delete in my ~/Library/Developer/Xcode/DerivedData directory?
The accepted answer to this question suggests that I should not touch / remove folders from this directory. so what I did was
Found an existing build project folder for an app that I have available on Appstore
Deleted the folder from derived dir
launched XCode 5
Open that project
Clean Build
Tested and compiled it on a simulator
ReArchived
Everything worked. Nothing was broken.
Unless I missed something in that posts answer I want to make sure by asking experienced developers that if I delete all the folders from DerivedData it will not hurt me in building, testing and compiling those projects.
Yes, you can delete all files from DerivedData sub-folder (Not DerivedData Folder) directly.
That will not affect your project work. Contents of DerivedData folder is generated during the build time and you can delete them if you want. It's not an issue.
The contents of DerivedData will be recreated when you build your projects again.
Xcode8+ Update
From the Xcode8 that removed project option from the window tab so you can still use first way:
Xcode -> Preferences -> location -> click on small arrow button as i explain in my first answer.
Xcode7.3 Update
For remove particular project's DeriveData you just need to follow the following steps:
Go to Window -> Project:
You can find the list of project and you can either go the DerivedData Folder or you can direct delete individual Project's DerivedData
I am not working on Xcode5 but in 4.6.3 you can find DerivedData folder as found in the below image:
After clicking on Preferences..
You get this window
I purge derivedData often enough that I have an alias for it. It can fix build problems. I have the following in /Users/Myusername/.bash_profile
alias purgeallbuilds='rm -rf ~/Library/Developer/Xcode/DerivedData/*'
Then in terminal, I type purgeallbuilds, and all subfolders of DerivedData are deleted.
XCODE 12 UPDATE
On the tab:
Click Xcode
Preferences
Locations -> Derived Data
You can access all derived data and clear by deleting them.
XCODE 7.2 UPDATE
(Also works for 7.1.1)
Click Window then Projects and then delete Derived Data.
Like this:
And then delete it here:
Hope that helps!
$ du -h -d=1 ~/Library/Developer/Xcode/*
shows at least two folders are huge:
1.5G /Users/horace/Library/Developer/Xcode/DerivedData
9.4G /Users/horace/Library/Developer/Xcode/iOS DeviceSupport
Feel free to remove stuff in the folders:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
and some in:
open ~/Library/Developer/Xcode/iOS\ DeviceSupport/
Just created a github repo with a small script, that creates a RAM disk. If you point your DerivedData folder to /Volumes/ramdisk, after ejecting disk all files will be gone.
It speeds up compiling, also eliminates this problem
xc-launch repo
Best launched using DTerm
XCode 8: To delete derived data for your current project:
Click Product menu
Hold Option key
Click Clean Build Folder
XCODE 10 UPDATE
Click to Xcode at the Status Bar
Then Select Preferences
In the PopUp Window Choose Locations before the last Segment
You can reach Derived Data folder with small right icon
~/Library/Developer/Xcode/DerivedData
yes, safe to delete, my script searches and nukes every instance it finds, easily modified to a local directory
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
IFS=$'\n\t'
for drive in Swap Media OSX_10.11.6/$HOME
do
pushd /Volumes/${drive} &> /dev/null
gfind . -depth -name 'DerivedData'|xargs -I '{}' /bin/rm -fR '{}'
popd &> /dev/null
done
I would say it's safe--I often delete the contents of the folder for many kind of iOS projects, this way. And, I haven't had any issues with builds or submitting to the App Store. The procedure deletes derived data and cleans a project's cached assets, for both Xcode 5 and 6.
Sometimes, simply calling rm -rf on the Derived Data directory leaves a lingering file or two, but my script loops until all files are deleted.
The content of 'Derived Data' is generated during Build-time. You can delete it safely. Follow below steps for deleting 'Derived Data' :
Select Xcode -> Preferences..
This will open pop-up window. Select 'Locations' tab.
In Locations sub-tab you can see 'Derived Data'
Click on arrow icon next to path.
This will open-up folder containing 'Derived Data'
Right click and Delete folder.
Related
Already tried : Code Sign Error on macOS Sierra, Xcode 8
Please see image showing error
CodeSign /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super\ Flow\ Flip.app
cd "/Volumes/Development/Project/Top Best Games/19. Lets Flow/35/let's FLOW - source/proj.ios_mac"
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Signing Identity: "iPhone Distribution: New Free Games (2CHN583K4J)"
Provisioning Profile: "Super Flow Flipp AppStore"
(c6c30d2a-1025-4a23-8d12-1863ff684a05)
/usr/bin/codesign --force --sign E48B98966150110E55EAA9B149F731901A41B37F --entitlements /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Intermediates/Flow.build/Debug-iphoneos/Super\ Flow\ Flip.build/Super\ Flow\ Flip.app.xcent --timestamp=none /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super\ Flow\ Flip.app
/Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super Flow Flip.app: resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
In Code Sign section its allowing me to select profile and certificate...but still giving error.
How to fix this problem ?
Solution 1:
Apple Developer Website Answers above problem Here.
Execute below command in terminal : First goto projects root folder
xattr -cr <path_to_project_dir>
Clean Xcode and Re-build.
Solution 2:
Just go to project root directory and run this command xattr -cr .
xattr -cr .
Clean Xcode and Re-build.
Solution 3:
You can fix this problem by finding files which holds finder information.
In terminal, goto project root directory and execute
ls -alR# . > kundapura.txt
This creates kundapura.txt in current directory. Now search for com.apple.FinderInfo and clear this attributes for all files. You can do it like this
xattr -c <filename>
Example: xattr -c guru.png
Once you clear all then code sign works. Clean Xcode and Re Build. Cheers
Solution 4: Inspired by Mark McCorkle's Answer
In terminal, goto project's root directory and execute one by one command
find . -type f -name '*.jpeg' -exec xattr -c {} \;
find . -type f -name '*.jpg' -exec xattr -c {} \;
find . -type f -name '*.png' -exec xattr -c {} \;
find . -type f -name '*.json' -exec xattr -c {} \;
Clean Xcode and Re-build.
The error is from attributes inside your image files. This happened from our graphics designer saving images from photoshop with attributes.
Here is a simple command to find all of your png files and remove their attributes. Run this in your projects root directory from terminal. Clean and rebuild; problem solved.
find . -type f -name '*.png' -exec xattr -c {} \;
If you have this error when codesigning an app:
resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
Go to your project root folder and execute
find . | xargs -0 xattr -c
This will clear attributes for all files.
In Sierra, the rules on what can be in a signed bundle have been tightened, and resource forks are no longer allowed. AppleScript has been saving information in resource forks forever, although that information has been unused for a long time. With Sierra, when you save a script, this resource fork information will no longer be saved.
It means you cannot codesign a script that was last saved in a version before Sierra; you have to save in Sierra to be able to sign in Sierra.
The people likely to be affected by are who bundle other scripts within their scripts (cordova?). They will not be able to sign the container script until all the embedded scripts have been resaved under Sierra.
UPDATE:
Seems like this also works:
xattr -rc .
If you have any insufficient permissions error try to prepend sudo: sudo xattr -rc .
The easiest way to handle attributes on your source files is to have Xcode clear up the archive before it runs codesign. To do this:
Select your target in XCode
Select the Build Phases tab
Press the + symbol
Select New Run Script Phase
Enter the following for the script:
xattr -cr ~/Library/Developer/Xcode/DerivedData || echo Clear
Now when you build your target it will clear out any attributes that would have broken codesign. By clearing out at this stage you don't have to alter your source code / project directory.
The "|| echo Clear" part of the script ensures that the project build continues even if xattr errors.
This method is good if you use programs such as DropBox on your code repository that add the attributes, as it doesn't change your source project, only the built archive.
You may need to change the path to match your DerivedData directory - this path will be shown next to the codesign error.
I have used following command. Use terminal window. Navigate to your Project and execute following:
xattr -rc .
There is official Apple answer for this issue in Technical Q&A QA1940.
This is a security hardening change that was introduced with iOS 10,
macOS Sierra, watchOS 3, and tvOS 10.
Code signing no longer allows any file in an app bundle to have an
extended attribute containing a resource fork or Finder info.
To see which files are causing this error, run this command in
Terminal: xattr -lr <path_to_app_bundle>
You can also remove all extended attributes from your app bundle with
the xattr command: xattr -cr <path_to_app_bundle>
<path_to_app_bundle> can be replaced with directory of your Xcode project. For example ~/Development/MyProject
All about clearing files is fine, but tedious for multiple projects.
graphics apps, (like photoshop in old versions) write additional info (we now call it metadata..) in an old fashion in external files, or they came frm older OSX, files like:
"com.apple.ResourceFork" and "com.apple.FinderInfo", when unzipping folder, for example.
Xcode 8 refuses to add it to a build (as You added them to a project with a "git --add ." maybe..)
You can find in terminal recursively and delete them, but can be tedious.
I wrote a small free utility to delete it.. hope it can help..
https://itunes.apple.com/us/app/cleandetritus/id1161108431?ls=1&mt=12
For those (like me) who are just trying to develop an app without having to strip extended attributes on every new photoshop created PNG added to the macOS target, you can temporarily disable code signing by adding a user defined build setting:
CODE_SIGNING_ALLOWED = No
Obviously, one distributing an app needs to eventually deal with the issue but this enables development in cases like mine where it wasn't necessarily straightforward to omit code signing in Sierra (on past OS X / Xcode it was easier to do so).
Per RGriffith's comment, here are a few screenshots for those who aren't sure how the custom build setting is added.
Simple solution:-
How I did [Working for me]
Step 1:-
Go to this folder - from your finder press option Go - > Go to Folder
then type your project path like this
example:-
Library/Developer/Xcode/DerivedData/yourprojectname/Build/Products/Debug-iphoneos
Now you can see a window pop with list of available File, There you see yourApp.app file [ Don't do anything just wait for step 2].
Step 2:-
Open new Terminal and type just cd then just drag step 1 yourApp.app to terminal, now you will get the path for the app, now press enter button.
Step 3:-
Now type this command **
xattr -rc .
Don't miss "."(Dot) press enter button.
That's it, Go to your Xcode project and clean and run again.
-----In case you can't apply the solutions above, because of lack of bash knowledge or something else.
I had this problem as soon as I enabled iCloud Drive on my Sierra. And my project was in a folder which was synced with iCloud Drive. I suppose this is what adds those additional attributes.
Temporary solution:
Disable iCloud Drive for the folder where your project is.
You will need to delete the app bundle folder and rebuild the app as explained below.
My app is called: augment
In terminal window, goto your app folder
e.g.: cd /Users/username/Library/Developer/Xcode/DerivedData/
In terminal window run command for your app folder
e.g.: xattr -cr augment-flmbiciuyuwaomgdvhulunibwrms
Clean>Build>Run.
There is also a free app on Mac Appstore called "CleanDetritus" which will do removal of these.
This problem came to me yesterday.
(What's wrong) I updated image resources by manually replacing file in finder and I failed with this compilation error.
(What's right) Don't update image in this way. After that I dragged images to 'xcassets' in Xcode. No more error appear again.
My problem is every change I make in the code and execute again the error reappears. Then I find a solution to execute the command automatically every compilation/execution of code.
Thanks to #rich-able I discovered "Run Script". Then I put the command "xattr -cr ." in the field.
One of the best solution is
Go to terminal type this
xattr -cr "Full path of your project"
To find full path of your right click on Xcode project->get info -> copy path and replace with .
Then type below command
xattr -cr "Full path of your project"
Clean and build done.
The simplest fix may be if you are using git. Try:
$ git stash
$ git stash pop
Git does not store file metadata, the above will strip it all away.
Open terminal and just run this command.
xattr -cr "path to .app file"
I found that if I add color tag on the folder under DerivedData, it will give the above error when debug on device.
Remove the color Tag fix this error for me.
My problem was that I used cordova to build the app around 1 year ago, but it wasn't compatible with the new version of xcode, so I simply used cordova build ios and it worked again.
If the xattr commands doesn't the trick this may be due to an XCode 9 bug:
let's try to remove and re-add the resource folder (it was a .xcassets in my case) containing the affected files from Xcode. (you should understand which are the affected files previous through the xattr -lr command)
The problem is in the derived data, You should clean the derived data and then clean the project and build. Please check this link.
I'm also facing the same issue, got fixed by just restarting my Macbook.
You can remove the derived data
Xcode -> Preferences
And click on the arrow below Derived Data, and empty the folder Derived Data
I don't know what happened to me, but when I was running flutter app on simulator, I was encountered by the error. I used flutter clean command and removed the derived data and then everything goes fine.
My .app was on a network mounted drive.
codesign -f -vv --preserve-metadata=entitlements -s {*my Apple distribution cert SHA*} my.app
my.app: resource fork, Finder information, or similar detritus not allowed
I don't know if too long path or the fact it was on a NAS device was a problem. I copied the .app to my local Downloads directory, and then was able to codesign.
my.app: signed app bundle with Mach-O thin (arm64) [*com.something.my*]
This happened to me as well when I duplicated a .plist file and edited it, instead of creating a new one. the xattr -lr <path> command helped me identify the problematic file.
My issue was related to unintended changes on framework integrated using Carthage. I had modified one line in framework by mistake and it didn't show up in git because dependency build folder was ignored from git.
Solution : Deleted framework folder in Carthage and rebuilt it.
I have an issue that I can only assume is with Xcode, where my apps take forever to run and crash the phone/restart about 75% of the time. I tried using older versions of the code that I'd saved instead, but they had the same effect, which they didn't use to have about a month ago.
I've looked up every single possible way to solve this issue for the past few weeks have haven't found anything, so I want to completely uninstall Xcode and clear all settings; but I can't find a way to do this. I can uninstall it, but when I reinstall it, it still has all of my old settings and lists of projects etc. How can I completely uninstall it?
For complete removal old Xcode 7 you should remove
/Applications/Xcode.app
/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/Caches/com.apple.dt.Xcode
~/Library/Application Support/Xcode
~/Library/Developer/Xcode
~/Library/Developer/CoreSimulator
For a complete removal of Xcode 10 delete the following:
/Applications/Xcode.app
~/Library/Caches/com.apple.dt.Xcode
~/Library/Developer
~/Library/MobileDevice
~/Library/Preferences/com.apple.dt.Xcode.plist
/Library/Preferences/com.apple.dt.Xcode.plist
/System/Library/Receipts/com.apple.pkg.XcodeExtensionSupport.bom
/System/Library/Receipts/com.apple.pkg.XcodeExtensionSupport.plist
/System/Library/Receipts/com.apple.pkg.XcodeSystemResources.bom
/System/Library/Receipts/com.apple.pkg.XcodeSystemResources.plist
/private/var/db/receipts/com.apple.pkg.Xcode.bom
But instead of 11, open up /private/var/in the Finder and search for "Xcode" to see all the 'dna' left behind... and selectively clean that out too. I would post the pathnames but they will include randomized folder names which will not be the same from my Mac to yours.
but if you don't want to lose all of your customizations, consider saving these files or folders before deleting anything:
~/Library/Developer/Xcode/UserData/CodeSnippets
~/Library/Developer/Xcode/UserData/FontAndColorThemes
~/Library/Developer/Xcode/UserData/KeyBindings
~/Library/Developer/Xcode/Templates
~/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/MobileDevice/Provisioning Profiles
Open Storage Management
Go to > About This Mac > Window > Storage Management
Or, hit ⌘ + Space to open Spotlight and search for Storage Management.
Select Applications on left pane.
Right click on Xcode on the right pane and select delete.
This will remove XCode from the installed applications list of your Mac's App Store.
Update: This worked for me on macOS Sierra 10.12.1.
Before taking such drastic measures, quit Xcode and follow all the instructions here for cleaning out the caches:
How to Empty Caches and Clean All Targets Xcode 4
If that doesn't help, and you decide you really need a clean installation of Xcode, then, in addition to all of the stuff in that answer, trash the Xcode app itself, plus trash your ~/Library/Developer folder and your ~/Library/Preferences/com.apple.dt.Xcode.plist file. I think that should just about do it.
FOR UNINSTALLING AND THEN BEING ABLE TO REINSTALL XCODE 9 CORRECTLY
I followed the topmost answer for deleting Xcode 7 and found a major error, deleting ~/Library/Developer will delete an important folder called PrivateFrameworks, which will actually crash Xcode everytime you reinstall and force you to have to get your friends to send you the PrivateFrameworks folder again, a complete waste of time seeing if you needed to uninstall and reinstall Xcode urgently for immediate work purposes.
I have tried editing the topmost answer but see no changes so below is the modified steps you should take for Xcode 9:
Delete
/Applications/Xcode.app
~/Library/Preferences/com.apple.dt.* (Generally anything with com.apple.dt. as prefix is removable in the Preferences folder)
~/Library/Caches/com.apple.dt.Xcode
~/Library/Application Support/Xcode
Everything in
/Library/Developer directory except for
/Library/Developer/PrivateFrameworks
This answer should be more of a comment against Dawn Song's comment earlier, but since I don't have enough reputation, I'm going to write it as an answer.
According to the forum page
https://forums.developer.apple.com/thread/11313
"In general, you should never just delete the CoreSimulator/Devices directory yourself. If you really absolutely must, you need to make sure that the service is not runnign while you do that. eg:"
# Quit Xcode.app, Simulator.app, etc
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
rm -rf ~/Library/*/CoreSimulator
I definitely ran into this issue after deleting and reinstalling Xcode.
You might encounter a problem trying to connect the build to a simulator device. The thread also answers what to do in that case,
gem install snapshot
fastlane snapshot reset_simulators
Run this to find all instances of Xcode in your filesystem:
for i in find / -name Xcode -print; do echo $i; done
I have a working project that builds ok. (Xcode 6.0.1)
There were images added that were at one folder (/Downloads) and were substituted by new ones (/MyDir/MyProject).
At adding files process copy options, group and add to it's targets were selected.
After a copy and paste at Finder from the root project folder to the new project some images contain references at Targets / Build Phases / Copy Bundle Resources to old folder (Downloads) while they are ok at original project.
I've deleted the .git from initial project to make sure it's not a git problem.
Already tried
rm -rf ~/Library/Developer/Xcode/DerivedData/
Any ideas? Thank you
In the rightmost panel, which contains Identity and Type, check to see if the "Location" field is Absolute Path, Relative to Group, or Relative to Project, and set each file accordingly to what it should be. Xcode seems to create new files with creative ideas on how this should be set.
check in your project build phases if there are some missing references and delete the one you don't need
After deleting/adding some png files to project, i have got messages when building project.
"file ProjectPath\aaa\xxx.png is missing from working copy."
All these files are in the project, and the application is running. However, these messages are annoying. Looked .plist file, but there is no mention of these files.
What should I do to remove these messages?
The warning will disappear as soon as you commit your changes (Xcode 8).
It seems that this problem may have different causes, but it's often in relation with source control software.
In my case, I solved it by going to Git, and adding the files again. I mean running the following command:
git add .
You can also disable source control by unchecking
Xcode -> Preferences -> Source Control -> Enable Source Control
if you're managing it via command line or any other app.
In XCode -> SoureControl:
Update + Refresh Status did it for me.
In my case, the file was missing from the source control.
To fix, I had to discard this file (be careful only discard the missing file not all your project):
Xcode->Source Control->commit
Right Click the missing file
Choose Discard Changes
Disable Source Control, clean build folder (Alt+Shift+Cmd+K), then Enable Source Control again.
Xcode -> Preferences -> Source Control -> Enable Source Control
In my case, Xcode had somehow found old .svn directories that referenced the missing files. I had to go up a level above my project folder to find those .svn files. Once deleted, I restarted Xcode and everything was fine.
I had a similar issue with a handful of files that had long since been deleted from my Xcode project while I was still using Xcode 7.
My solution was to:
Create files with the names Xcode was complaining about (they don't need any content)
Add the files to my Xcode project (in Xcode right click on my main project directory, click Add files to my_project_name and select the files that were just created
Select the newly added files and delete them - select move to trash.
This got rid of the warnings for me.
To add onto Alexander Vasenin's answer...
First I Committed and Pushed my changes
Xcode Main Menu > Source Control > Commit
Then I Discarded All Changes to get rid of the errors
Xcode Main Menu > Source Control > Discard All Changes
After that, the errors stating "file xxx.png is missing from working copy" disappeared.
This is occurred when you delete file on Xcode, but didnt tell svn server about it.
Go to command line tool, and delete file directly.
svn delete missingFile.m
and commit it
svn commit -m "Deleting file"
note that if you delete .svn folder, the warning is disappear but you will lost communication with svn server.
I worked it out.
just open your third-party SVN tool, find the miss files, Revert;
that's all.
I had same problem and solved it by add git .
Open Command Line Tool
cd "project folder path"
git add .
Later,restart Xcode project and open your project again.
Show on target->build phases -> copy Bundle Resources.
and
clean build folder command+shift+alt+k
I had to manually go into Terminal and remove the files with git rm ProjectPath\aaa\xxx.png and then commit. After that everything worked fine.
Got this for every project after moving on to XCode 8. This solved it:
With Option Key pressed, Product (in title menu) -> Clean Build Folder.
In my case, I had wrong data from my old projects in the simulator. Solved by reset content and settings in the simulator:
Simulator -> Reset content and settings...
For me the following worked:
Since I do not and did never use Git, I created a new project (XCode 8, I could not see the usual "use Git" or however the checkmark was labeled). Then I bluntly deleted all the files in this new project; went to the old messed up project, copied everything in the project folder, came back to the newly created project, pasted the old stuff, opened that - all the warnings about files that have not been existing for months are gone. Fingers crossed.
I had the same issue and solved it by simply dragging the specified files from finder into the project navigator (ensuring that "copy files" is selected in the dialog) and committing the files.
These warnings are not build warnings, they are about your SVN repository.
It is correct that the directories shown no longer exist, CocoaPods stores the headers in Pods/Headers/{Private,Public} now. You have to update your working copy to reflect those changes.
In my case I drag & dropped a number of files on my Xcode project window to add them. It made copies into my source directory but didn't put them where I wanted them to go (it put them at the root of my directory, I wanted them in a sub-directory). Without thinking I just grabbed them in the Finder and moved them to the directory I wanted them in. After going back into the project window it of course could not find them so I deleted them in the window and re added them. After compiling I started getting these errors.
I thought, as some mention above that it was a git issue but when I ran "git ls-tree --full-tree -r HEAD" I didn't see the files at all??
Anyway to fix it all I did was use the "Add File..." menu command to add each of the files to the default location, do a clean build, and then delete them from the project window (using move to trash) and it got rid of all the errors.
I had the warnings, and also could not commit changes under XCode (using svn). All I had to do was restart XCode and the problem went away.
This works for me:
Xcode -> ("option + click") Product -> Clean Build Folder...
Than restart xCode
In my case it was a problem with git and a case-insensitive file system.
I had inadvertently submitted the same file twice, using file paths that differed only in case:
MyProject/Resources/foo.png
MyProject/resources/foo.png
Xcode was complaining about one of the missing files.
Fixed by deleting the offending files, and re-adding.
cd MyProject
mv Resources/foo.png /tmp
git rm Resources/foo.png
git rm resources/foo.png
git commit
mv /tmp/foo.png Resources
git add Resources/foo.png
git commit
This is definitely related to source control. I renamed and moved a couple of non-committed plist files and got this error. I am using svn. I was able to fix this via Source Control - Commit by removing old referenced files.
I am adding resources (lots of .pngs and other) to my iPhone project dragging the folder to it and choosing "Create Folder references for any added Folder", to retain the folder structure.
They are correctly added to the Copy Resources build phase.
Problem is, I am wasting A LOT of time because when I create/delete/update a new resource, it will often ignore changed files and stick with the older version.
Looks like it tries to only updates resources when they are changed, but it fails to see the changes.
In the simulator it was possible to manually update the files in the .app, but when working on the device it will complain that the code sign of some resources has changed!
The only reliable way I've found to force it to update everything is deleting the build products, the app and the device app some times, until it finally decides to forget about the old version, but doing this for each resource change is wasting me an insane amount of time (game content changes more than often).
So, in short: how do I force XCode to disable "versioning" and to just scrap all the resources and copy them all each time?
Thanks!
EDIT: I have found that deleting the .app folder built in "build" folder always forces XCode to add new files...
I still have no clue on where it keeps the old files when I delete that folder, but this is for the better as it only copies new resources as intended.
So a simple script like
rm -rf "$CODESIGNING_FOLDER_PATH"
Does the trick of deleting the folder at each build...
Unfortunately, XCode apparently runs the codesigning BEFORE anything in the Build Phases tab is executed, so it updates the old target, the script deletes the old target, and then it crashes complaining that no Code Signing Resources were found.
So... I have to stick with manually deleting the file, or is there a way to run a script before code signing?
I had this kind of issue as well, about files not getting updated when I built my project (A PhoneGap project, but that should not matter).
What I did, was add this to the Build Phase of my project:
find "${PROJECT_DIR}/www/." -exec touch -cm {} \;
That will make sure the files are being picked up as updated when XCode builds the project. Of course, you should modify the command to your needs - my needs were to update the www folder on build, as I am editing my files using Visual Studio, running in a VM.
Ok, I finally found a (somewhat ugly) workaround against this.
In you project, create two aggregate targets, say Clean Build and Cleaner.
In Cleaner, add a "Run Script" Phase with rm -rf "$CODESIGNING_FOLDER_PATH" that will purge the temporary app from the build folder.
In Clean Build, add first Cleaner, and then your normal app target to the Target Dependencies.
Select Clean Build from the run list, then Edit Scheme and set your app target as the executable. Hit run, and it should work :)
You might want to use the Clean option under the Product menu (or hold down shift and command and press K) after you update a resource and before you build the updated app. I have noticed that this has helped me out at times when I update a resource or a user-defined build setting.