开发者

Moving files within Xcode

I want to move a file I have in PROJECT/PROJECT.xcodeproj to PROJECT/Classes.

The problem with just dragging within Xcode is that Xcode's file hierarchy system is different from the actual system.

The problem with m开发者_开发技巧oving it within Finder/Terminal is that it breaks things and things no longer work.

Please let me know of a solution. Thanks!


Works in Xcode 5:

  1. Move the file in Finder
  2. Observe that the reference in Xcode turns red
  3. Open the right panel (⌘⌥0)
  4. Select “Relative to Project” from the Location picker.
  5. Click the folder icon under Location.
  6. Select the new file location.

This allows you to both move files and rename them (both at once if you like).

Edit: Notably, Xcode 9 supposedly will move files on the filesystem if your group structure mimics the file system.


I have had the same issue. Groups do not represent folders in the file system. I solved my problem by

  1. removing the references from the project
  2. moving files into the right folders
  3. add files to the project again. (and do not check the "copy files" option)


heres a solution:

move the file from your proj to desktop.

move from desktop back in your proj (select copy resources into folder)


Xcode9 nearly handles moving files within Xcode flawlessly. Using Xcode, create a new Group/folder and drag the source files into it. Although Xcode updated the 'build settings' 'compile targets' correctly but when I did a clean build it was still trying to compile using the old locations.

After restarting xCode 9 it worked.


actually, you can just choose to "delete" the files within Xcode. When prompted, select "remove reference" instead of "move to the trash can"

now move the actual files to the location you desire in Finder

Back to Xcode and select "Add file to " after right clicking your project (I have the track pad, so I have the double-finger).


You can move them in a somewhat convoluted way without completely removing and re-adding them this way:

Moving Files into a Real Folder in Xcode

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜