移动xcode项目导致红色文本(从项目中丢失文件)

时间:2023-01-13 20:14:26

When I move iphone project directory to a new path. There are some red texts indicate the missing files from the project source codes. How to aovoid these?

当我移动iphone项目目录到一个新的路径。有一些红色的文本表示项目源代码中丢失的文件。如何aovoid这些吗?

11 个解决方案

#1


63  

Here is how to locate the missing (red) files using the Xcode 4 interface:

以下是如何使用Xcode 4接口定位丢失的(红色)文件:

  1. Select the file or files in the left hand Project Navigator (the folder icon)
  2. 选择左边项目导航器中的文件或文件(文件夹图标)
  3. In the right sidebar click on "File Inspector" which is the leftmost icon resembling a page
  4. 在右边的侧边栏点击“文件检查器”,这是最左边的图标,类似于页面。
  5. In the "Identity and Type" section, there is a grey box labeled "Location".
  6. 在“身份和类型”一节中,有一个灰色方框标为“位置”。
  7. Click on the small icon to the lower left that resembles a file browser - this will come up with a file browser to locate the file.
  8. 点击左下方类似文件浏览器的小图标——这将会产生一个文件浏览器来定位文件。

Voila, you are done.

瞧,你做的。

#2


10  

I encountered this issue when copying my project from one mac to another. The solution for me:

当我将我的项目从一个mac拷贝到另一个mac时,我遇到了这个问题。我的解决方案:

assuming your files are grouped (in folder)

假设您的文件被分组(在文件夹中)

  1. from xcode open the group in file inspector

    从xcode中打开文件检查器中的组

  2. The group will probably be missing the absolute path.

    这群人可能会错过绝对的路径。

  3. press the little icon nearby to pick the folder to associate the group with.

    按下附近的小图标,选择与组相关联的文件夹。

  4. restart xcode to see the changes.

    重新启动xcode查看更改。

#3


10  

Xcode 7

Xcode 7

1.) Right click on the red (missing) file.

1)。右击红色(缺失)文件。

2.) Select "Show File Inspector"

2)。选择“显示文件检查器”

3.) Look at the right hand side of the screen under "Identity and Type" between "Location" and "Full Path"

3)。在“位置”和“完整路径”之间的“标识和类型”下查看屏幕的右手边

4.) Click on the folder icon to the right of the file name.

4)。单击文件名右边的文件夹图标。

5.) Navigate to the file's new location in the pop-up window and select the file.

5)。在弹出窗口中导航到文件的新位置并选择文件。

#4


3  

I had the same problem, when I changed the permission on the files/folders to everyone read/write they then appeared in Xcode.

我遇到了同样的问题,当我把文件/文件夹的权限修改为每个人读/写的时候,他们就会出现在Xcode中。

#5


2  

This worked on a Pod project. Quit XCode.

这是一个Pod项目。XCode辞职。

rm -rf project.xcworkspace/xcuserdata/*

rm射频project.xcworkspace / xcuserdata / *

Restart XCode and reopen project.

重新启动XCode并重新打开项目。

#6


1  

  1. In Finder, create a duplicate of the project directory just in case all goes squiffy.
  2. 在Finder中,创建一个项目目录的副本,以防所有文件都被压缩。
  3. In Finder, open the project directory that contains all the files with red references
  4. 在查找程序中,打开包含所有带有红色引用的文件的项目目录
  5. For all the red files you see in XCode, except the info.plist file (see step 5 below), highlight them in Finder and drag them from Finder to XCode's project navigator. i.e. import them.
  6. 所有你在XCode中看到的红色文件,除了信息。plist文件(参见下面的第5步),在Finder中突出显示它们,并将它们从Finder拖到XCode的项目导航器。即导入它们。
  7. In XCode's "Choose options for adding these files" window: a) Select Copy items into Destination's group folder (if needed) b) Select Create groups for any added folder c) Select Add to Targets, and press Finish
  8. 在XCode的“选择添加这些文件的选项”窗口中:a)选择将项目复制到目标的组文件夹(如果需要)b)为任何添加的文件夹c选择创建组)选择添加到目标,然后按Finish
  9. Highlight and drag the info.plist file from Finder to Project Navigator and repeat step 4 WITHOUT selecting Add to Targets
  10. 突出显示并拖动信息。plist文件从查找器到项目导航器,重复步骤4,而不选择添加到目标
  11. If you had groups in Project Navigator (e.g. Supporting Files), reorder the files to be in the right places.
  12. 如果您在Project Navigator中有组(例如,支持文件),请将文件重新排序到正确的位置。
  13. Delete the original bad red references in Project Navigator, and Cmd-Shift-K to clean for good measure.
  14. 删除项目导航中原始的错误的红色引用,以及Cmd-Shift-K,以保持良好的度量。
  15. Build and run on a device to remove the bad reference to the .app file
  16. 在设备上构建并运行,以删除对.app文件的错误引用

#7


1  

you just have to locate the missing file press in file icon in the identity and type you will find the full path just locate your file where do you move it click the file icon 移动xcode项目导致红色文本(从项目中丢失文件)

你只需要找到丢失的文件按在文件图标中的标识和类型你会找到完整的路径找到你的文件在哪里移动它点击文件图标

#8


0  

When you create these files be sure to save in your app directory. Or if you import classes from other project be sure to check the copy option.

当您创建这些文件时,请确保保存在您的应用程序目录中。或者,如果您从其他项目导入类,一定要检查copy选项。

#9


0  

I dont know if this is the main reason but when you are importing files to the application, do you mary the "Copy items in to destination group's folder (if needed)" ?

我不知道这是否是主要的原因,但当你向应用程序导入文件时,你会将“项目复制到目标组的文件夹中(如果需要的话)”吗?吗?

this make sure the file is not only referenced but added to your project folder and ir will move any where you move your project.

这确保文件不仅被引用,还被添加到项目文件夹中,ir将移动到您移动项目的任何位置。

#10


0  

Did you move files in to folders directly in your project folder and not in xcode?

您是否将文件直接移动到项目文件夹中的文件夹中,而不是在xcode中?

#11


-3  

It's too simple to do : Close the project that includes the missed files and open the Xcode, go to "Organizer">"Projects" and remove the project from the list there. Open your project from Finder and that's it.

这样做太简单了:关闭包含丢失文件的项目并打开Xcode,转到“Organizer”>“Projects”并从那里的列表中删除该项目。从Finder中打开项目。

hope this help.

希望这个有帮助。

#1


63  

Here is how to locate the missing (red) files using the Xcode 4 interface:

以下是如何使用Xcode 4接口定位丢失的(红色)文件:

  1. Select the file or files in the left hand Project Navigator (the folder icon)
  2. 选择左边项目导航器中的文件或文件(文件夹图标)
  3. In the right sidebar click on "File Inspector" which is the leftmost icon resembling a page
  4. 在右边的侧边栏点击“文件检查器”,这是最左边的图标,类似于页面。
  5. In the "Identity and Type" section, there is a grey box labeled "Location".
  6. 在“身份和类型”一节中,有一个灰色方框标为“位置”。
  7. Click on the small icon to the lower left that resembles a file browser - this will come up with a file browser to locate the file.
  8. 点击左下方类似文件浏览器的小图标——这将会产生一个文件浏览器来定位文件。

Voila, you are done.

瞧,你做的。

#2


10  

I encountered this issue when copying my project from one mac to another. The solution for me:

当我将我的项目从一个mac拷贝到另一个mac时,我遇到了这个问题。我的解决方案:

assuming your files are grouped (in folder)

假设您的文件被分组(在文件夹中)

  1. from xcode open the group in file inspector

    从xcode中打开文件检查器中的组

  2. The group will probably be missing the absolute path.

    这群人可能会错过绝对的路径。

  3. press the little icon nearby to pick the folder to associate the group with.

    按下附近的小图标,选择与组相关联的文件夹。

  4. restart xcode to see the changes.

    重新启动xcode查看更改。

#3


10  

Xcode 7

Xcode 7

1.) Right click on the red (missing) file.

1)。右击红色(缺失)文件。

2.) Select "Show File Inspector"

2)。选择“显示文件检查器”

3.) Look at the right hand side of the screen under "Identity and Type" between "Location" and "Full Path"

3)。在“位置”和“完整路径”之间的“标识和类型”下查看屏幕的右手边

4.) Click on the folder icon to the right of the file name.

4)。单击文件名右边的文件夹图标。

5.) Navigate to the file's new location in the pop-up window and select the file.

5)。在弹出窗口中导航到文件的新位置并选择文件。

#4


3  

I had the same problem, when I changed the permission on the files/folders to everyone read/write they then appeared in Xcode.

我遇到了同样的问题,当我把文件/文件夹的权限修改为每个人读/写的时候,他们就会出现在Xcode中。

#5


2  

This worked on a Pod project. Quit XCode.

这是一个Pod项目。XCode辞职。

rm -rf project.xcworkspace/xcuserdata/*

rm射频project.xcworkspace / xcuserdata / *

Restart XCode and reopen project.

重新启动XCode并重新打开项目。

#6


1  

  1. In Finder, create a duplicate of the project directory just in case all goes squiffy.
  2. 在Finder中,创建一个项目目录的副本,以防所有文件都被压缩。
  3. In Finder, open the project directory that contains all the files with red references
  4. 在查找程序中,打开包含所有带有红色引用的文件的项目目录
  5. For all the red files you see in XCode, except the info.plist file (see step 5 below), highlight them in Finder and drag them from Finder to XCode's project navigator. i.e. import them.
  6. 所有你在XCode中看到的红色文件,除了信息。plist文件(参见下面的第5步),在Finder中突出显示它们,并将它们从Finder拖到XCode的项目导航器。即导入它们。
  7. In XCode's "Choose options for adding these files" window: a) Select Copy items into Destination's group folder (if needed) b) Select Create groups for any added folder c) Select Add to Targets, and press Finish
  8. 在XCode的“选择添加这些文件的选项”窗口中:a)选择将项目复制到目标的组文件夹(如果需要)b)为任何添加的文件夹c选择创建组)选择添加到目标,然后按Finish
  9. Highlight and drag the info.plist file from Finder to Project Navigator and repeat step 4 WITHOUT selecting Add to Targets
  10. 突出显示并拖动信息。plist文件从查找器到项目导航器,重复步骤4,而不选择添加到目标
  11. If you had groups in Project Navigator (e.g. Supporting Files), reorder the files to be in the right places.
  12. 如果您在Project Navigator中有组(例如,支持文件),请将文件重新排序到正确的位置。
  13. Delete the original bad red references in Project Navigator, and Cmd-Shift-K to clean for good measure.
  14. 删除项目导航中原始的错误的红色引用,以及Cmd-Shift-K,以保持良好的度量。
  15. Build and run on a device to remove the bad reference to the .app file
  16. 在设备上构建并运行,以删除对.app文件的错误引用

#7


1  

you just have to locate the missing file press in file icon in the identity and type you will find the full path just locate your file where do you move it click the file icon 移动xcode项目导致红色文本(从项目中丢失文件)

你只需要找到丢失的文件按在文件图标中的标识和类型你会找到完整的路径找到你的文件在哪里移动它点击文件图标

#8


0  

When you create these files be sure to save in your app directory. Or if you import classes from other project be sure to check the copy option.

当您创建这些文件时,请确保保存在您的应用程序目录中。或者,如果您从其他项目导入类,一定要检查copy选项。

#9


0  

I dont know if this is the main reason but when you are importing files to the application, do you mary the "Copy items in to destination group's folder (if needed)" ?

我不知道这是否是主要的原因,但当你向应用程序导入文件时,你会将“项目复制到目标组的文件夹中(如果需要的话)”吗?吗?

this make sure the file is not only referenced but added to your project folder and ir will move any where you move your project.

这确保文件不仅被引用,还被添加到项目文件夹中,ir将移动到您移动项目的任何位置。

#10


0  

Did you move files in to folders directly in your project folder and not in xcode?

您是否将文件直接移动到项目文件夹中的文件夹中,而不是在xcode中?

#11


-3  

It's too simple to do : Close the project that includes the missed files and open the Xcode, go to "Organizer">"Projects" and remove the project from the list there. Open your project from Finder and that's it.

这样做太简单了:关闭包含丢失文件的项目并打开Xcode,转到“Organizer”>“Projects”并从那里的列表中删除该项目。从Finder中打开项目。

hope this help.

希望这个有帮助。