开发者

Adding files in Xcode 4: ensure the path is relative to the project/how to change path?

开发者 https://www.devze.com 2023-02-22 13:16 出处:网络
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

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:

  1. Reveal the project in finder
  2. Rightclick the *.xcodeproj file and choose "Show Package Contents"
  3. Open the project.pbxproj file with a text editor (e.g. TextWrangler)
  4. Find & Replace the absolute "../../../whatever/this/path/is/in/your/case/" part of all file and/or group paths with ""
  5. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消