Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode archive build fails with error Copy .strings file Error : Failed to remove

Tags:

ios

xcode4

When building the project for distribution using the Archive build mode, the following error appears. When building in debug or release mode everything works fine. The mentioned directory is empty. The directory permissions are set to full access for the current user. Any ideas?

CopyStringsFile /Users/username/Library/Developer/Xcode/DerivedData/ProjectName-bikjmxotbfpkybhkqwlxysxcibrk/ArchiveIntermediates/ProjectName/InstallationBuildProductsLocation/Applications/ProjectName.app/es.lproj/Localizable.strings ProjectName/Resources/es.lproj/Localizable.strings
cd /Users/username/Coding/proj/game/ProjectName
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin"
builtin-copyStrings --validate --inputencoding utf-8 --outputencoding binary --outdir /Users/username/Library/Developer/Xcode/DerivedData/ProjectName-bikjmxotbfpkybhkqwlxysxcibrk/ArchiveIntermediates/ProjectName/InstallationBuildProductsLocation/Applications/ProjectName.app/es.lproj -- ProjectName/Resources/es.lproj/Localizable.strings

error: failed to remove /Users/username/Library/Developer/Xcode/DerivedData/ProjectName-bikjmxotbfpkybhkqwlxysxcibrk/ArchiveIntermediates/ProjectName/InstallationBuildProductsLocation/Applications/ProjectName.app/es.lproj/Localizable.strings: “Localizable.strings” couldn’t be removed.
like image 380
pletoss Avatar asked Oct 08 '11 23:10

pletoss


5 Answers

This happened to me when I had duplicate references to a folder added to the project. Deleting the duplicate references fixed it.

like image 101
NoelHunter Avatar answered Nov 14 '22 09:11

NoelHunter


Ok, i figured it out:

I don't exactly know why Xcode wanted to delete a file that wasn't existent at that location in the first place, but it think it had to do with the project file which was broken for no apparent reason.

The way i fixed it was to just delete all the Localizable.strings files from the project ( i had 6 for different languages each in its own .lproj directory ) and then add them again one by one. –

like image 29
pletoss Avatar answered Nov 14 '22 09:11

pletoss


I also face this type of problem. But what I did is just clean up project "Product -> Clean" and rebuild it fix this problem

like image 6
user454083 Avatar answered Nov 14 '22 09:11

user454083


I had the same problem ... anyway, these 2 steps definitely solved it:

  1. Make sure the Localizable.strings files are encoded in UTF-16 instead of UTF-8. So if you need to convert them you can do it in XCode by choosing the files and changing the Text Encoding to UTF-16 in the File Inspector

  2. remove the references to the files from your project and re-add them. This should fix the CopyStringsFile error.

like image 2
Mobiletainment Avatar answered Nov 14 '22 09:11

Mobiletainment


I had the same problem and simply cleaning didn't fix it.

I have multiple Build Configurations set up in order to output different apps with different bundle identifiers and a custom script that copies some files. When creating new Build Configurations with new custom files, these files were automatically added to the "Copy Bundle Resources" Build Phase when my script was already taking care of them.

So what I needed to do was simply to remove them from the Copy Bundle Resources list in MyTarget > Build Phases.

like image 2
now Avatar answered Nov 14 '22 07:11

now