views:

193

answers:

2

I have set a header file's role in Xcode to private so that it will get copied to the desired location by the Copy Headers build phase. It works as expected if there is not already a header file of that name in the target location. But if there is an existing file, it does not overwrite it. Even if the header file has changed in the project it doesn't seem to update the copy in the target location. The Build Results windows shows a line "Copying MyFile.h" but the file is the old one.

This doesn't seem right and is definitely not what I want. How can I force Xcode to unconditionally copy (and overwrite if necessary) header files in the Copy Headers build phase?

A: 

Are you sure that you have actually changed the header file in the project? If Xcode says "Copying MyFile.h", then it's copying it. But if you accidentally changed the copy, instead of the original, then Xcode is simply doing what it thinks is right: copying the authentic version from the project over the altered version in the build product.

It would help if you'd paste the entire "pbxcp" line for that header, then it would be easy to see exactly what's going on.

cdespinosa
A: 

I took this question over to the Xcode mailing list and had some back and forth there. It turns out that Copy Headers copies the file to a subfolder of the build folder, not to the absolute address I specified. Maybe it is not intended for what I am doing.

I've reverted to using Run Script to do the file copying.

gauss256