In Xcode 4, I can't add files/resources to my project without having the Relative-to-Group path end up something like: ../../workspace/Project/Resources/thing.png
Ideally I would have Resources/thing.png
.
I have tried every possible combination of adding folders, files, making new groups. I wish to keep my resources in a folder within my project directory. If I omit the folder, clearly my assets will be relative to the project — just "thing.png" under the project's root.
Is there any way to change the path of a single file (I already know how to 'change the location the group represents') such that I can 开发者_运维技巧set the location manually (such as in Xcode 3, where this path crap would happen as well).
My dirty, but simple solution to this:
- Reveal the project in finder
- Rightclick the *.xcodeproj file and choose "Show Package Contents"
- Open the project.pbxproj file with a text editor (e.g. TextWrangler)
- Find & Replace the absolute "../../../whatever/this/path/is/in/your/case/" part of all file and/or group paths with ""
- Save the file and open the project in Xcode (it even worked when the project was already opened in Xcode)
I ran into the same issue. It turned out that the problem was Dropbox that would rewrite the paths for Xcode for some reason.
Moving the project to another location outside of my Dropbox solved the issue.
Under the same area in which you change the groups represented folder, (directly under the Location popup in the Identity and Type group of the File Utility area), there's a small icon to the right of the file name. Click that and choose the file again. That will update the path.
精彩评论