升级到 Xcode 4 后出现丢失文件警告
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5292291/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Missing file warnings showing up after upgrade to Xcode 4
提问by Scott
I recently upgraded to Xcode 4 (which is a great upgrade) but now I'm getting some warnings that I did not get before. I have looked through forums and other SO posts but have not come across how to fix this.
我最近升级到 Xcode 4(这是一个很好的升级),但现在我收到了一些我以前没有收到的警告。我已经浏览了论坛和其他 SO 帖子,但还没有遇到如何解决这个问题。
The warnings I get are project level warnings for a missing file. The files that are being shown have been deleted from the project navigator view (also choosing to delete from file system). However it still seems to be showing up as somehow linked to the project, even though the file no longer appears in the Project navigator.
我得到的警告是丢失文件的项目级警告。正在显示的文件已从项目导航器视图中删除(也选择从文件系统中删除)。然而,它似乎仍然显示为以某种方式链接到项目,即使该文件不再出现在项目导航器中。
I have looked around and not found how I can tell Xcode that these files are gone, stop giving me warnings. Here's a screenshot that I get in Xcode4, but never got in Xcode 3.
我环顾四周,没有找到如何告诉 Xcode 这些文件已经消失,不要再给我警告了。这是我在 Xcode4 中获得的屏幕截图,但从未在 Xcode 3 中获得。
回答by Sulthan
These solutions are way too difficult. The problem is that you have removed the project from filesystem but SVN still thinks they are there. Detaching project from SVN will work, the same for removing .svn folders BUT that is going to destroy your repository!
这些解决方案太难了。问题是您已经从文件系统中删除了该项目,但 SVN 仍然认为它们在那里。从 SVN 分离项目将起作用,删除 .svn 文件夹也是如此,但是这会破坏您的存储库!
It is much easier to open console, browse to your folder ("cd /pathToYourFolder") and type the following command:
打开控制台,浏览到您的文件夹(“cd /pathToYourFolder”)并键入以下命令要容易得多:
svn delete nameOfMissingFile
svn delete nameOfMissingFile
If the name of your missing file includes the @ character (eg: retina-specific artwork), ensure the file name terminates with the @ symbol:
如果您丢失的文件的名称包含 @ 字符(例如:特定于视网膜的艺术品),请确保文件名以 @ 符号结尾:
svn delete [email protected]@
svn delete [email protected]@
For GIT repositories:
对于 GIT 存储库:
git rm nameOfMissingFile
git rm nameOfMissingFile
回答by Alex
In XCode 4.2.+ (possibly in 4+) you can avoid manual work and command line :
在 XCode 4.2.+(可能在 4+)中,您可以避免手动工作和命令行:
- Select project Project Navigator (Command - 1)
- Choose File - Source Control - Commit menu
- In the left pane, on top of it you have three icons, select the middle one - File view
- You will see the list of all missing files
- Select all of them and right-click - Discard changes. This will restore all deleted files from the SVN server and place them in your local SVN folder
- Drag and drop those files into the XCode project (Choose Sort-Date Modified in Finder to easily find them)
- Delete those files properly through XCode (select files and choose right-click Delete)
- Commit the project
- 选择项目 Project Navigator (Command - 1)
- 选择文件 - 源代码管理 - 提交菜单
- 在左窗格中,顶部有三个图标,选择中间的一个 - 文件视图
- 您将看到所有丢失文件的列表
- 选择所有这些并右键单击 - 放弃更改。这将从 SVN 服务器恢复所有已删除的文件并将它们放在您本地的 SVN 文件夹中
- 将这些文件拖放到 XCode 项目中(在 Finder 中选择 Sort-Date Modified 以轻松找到它们)
- 通过 XCode 正确删除这些文件(选择文件并选择右键单击删除)
- 提交项目
And that's it :)
就是这样:)
All those nasty warnings are gone!
所有那些讨厌的警告都消失了!
Additionally for Xcode 6+:After selecting the file view 'middle icon' - you can click the checkbox to the left and this will mark them as deleted for SVN when you next commit!
另外对于 Xcode 6+:选择文件视图“中间图标”后 - 您可以单击左侧的复选框,这将在您下次提交时将它们标记为 SVN 已删除!
回答by Shamsudheen TK
In Xcode5 & Xcode6,below steps worked for me
在 Xcode5 和 Xcode6 中,以下步骤对我有用
Xcode
-> Preferences
-> Source Control
-> uncheck Enable Source Control
Xcode
-> Preferences
-> Source Control
->uncheck Enable Source Control
then
然后
Xcode
-> Preferences
-> Source Control
-> check Enable Source Control
Xcode
-> Preferences
-> Source Control
->check Enable Source Control
回答by Robert Neagu
It has something to do with .svn hidden folders in your project.
它与项目中的 .svn 隐藏文件夹有关。
I solved this issue by detaching the project from svn.
我通过将项目与 svn 分离来解决了这个问题。
a. Open terminal and type the following commands:
一种。打开终端并输入以下命令:
defaults write com.apple.finder AppleShowAllFiles TRUE?
defaults write com.apple.finder AppleShowAllFiles TRUE?
killall Finder
killall Finder
This will allow you to view the .svn folders inside your project
这将允许您查看项目中的 .svn 文件夹
b. Delete every .svn folder in your project folders/subfolders
湾 删除项目文件夹/子文件夹中的每个 .svn 文件夹
c. Re-enable hidden files:
C。重新启用隐藏文件:
defaults write com.apple.finder AppleShowAllFiles FALSE
defaults write com.apple.finder AppleShowAllFiles FALSE
?killall Finder
?killall Finder
d. Now your project is detached from svn and you no longer get build issues.
d. 现在您的项目与 svn 分离,您不再遇到构建问题。
e. Re-add your project to svn or whatever.
e. 将您的项目重新添加到 svn 或其他任何内容。
I'm a beginner myself and this was my way of dealing with that issue, so I'm not sure this is the best way to go. Anyway, the problem was solved.
我自己是初学者,这是我处理该问题的方式,所以我不确定这是最好的方法。总之,问题解决了。
回答by Tyson
This worked for me:
这对我有用:
File
-> Source Control
-> Hide Working Copy Status
File
-> Source Control
->Hide Working Copy Status
then
然后
File
-> Source Control
-> Show Working Copy Status
File
-> Source Control
->Show Working Copy Status
回答by askoric
I solved it the following way:
我通过以下方式解决了它:
- Check the path to the missing file.
- Create missing files at appropriate locations within your project directory
- Add them to your project using "Add Files to "project"" and create references only (do not copy the files)
- The warnings should disappear at this point.
- From within Xcode delete the files making sure you click "Delete" instead of the default "Delete Reference Only"
- You're done.
- 检查丢失文件的路径。
- 在项目目录中的适当位置创建丢失的文件
- 使用“将文件添加到“项目”将它们添加到您的项目中并仅创建引用(不要复制文件)
- 此时警告应该消失。
- 从 Xcode 中删除文件,确保单击“删除”而不是默认的“仅删除引用”
- 你完成了。
回答by Shaun McCarthy
Go in to the appropriate directory and run:
进入相应的目录并运行:
svn revert fileName
回答by Nick H247
I also had this problem, and as user151215 has described it IS due to .svn folders.
我也遇到了这个问题,正如 user151215 所描述的,这是由于 .svn 文件夹造成的。
I had a old .svn folder, not in the project itself but in the projects parent folder.
我有一个旧的 .svn 文件夹,不是在项目本身,而是在项目的父文件夹中。
the offending .svn folder will have an entries file that contains your missing files. So you can use Teminal and search for a missing file name string, e.g. grep -lir BagController.m yourRootDevDir/*
有问题的 .svn 文件夹将有一个条目文件,其中包含您丢失的文件。因此,您可以使用 Teminal 并搜索丢失的文件名字符串,例如 grep -lir BagController.m yourRootDevDir/*
simpler than enabling hidden files in finder, just use the terminal. cd to relevant directory, and mv .svn ~/.Trash
比在finder中启用隐藏文件更简单,只需使用终端即可。cd 到相关目录,然后 mv .svn ~/.Trash
Hope this helps!
希望这可以帮助!
回答by Jano
I had that bug and found no way to solve it other than creating an empty file on that position and then deleting it. It happened with files I had deleted from the project, and cleaning, building, deleting manually the Derived Data directory didn't work either. I believe it is a bug, and that it can be quite painful if it happens with more than a few files.
我有那个错误,除了在那个位置创建一个空文件然后删除它之外,没有办法解决它。它发生在我从项目中删除的文件中,并且手动清理、构建、删除派生数据目录也不起作用。我相信这是一个错误,如果它发生在多个文件中,它会非常痛苦。
回答by occulus
Disabling SVN in Xcode prevents these issues (assuming you're managing your repository with another SVN tool). See this question:
在 Xcode 中禁用 SVN 可以防止这些问题(假设您正在使用另一个 SVN 工具管理您的存储库)。看到这个问题:
Can you disable version control integration in Xcode 4?
Obviously, this might not be practical if there are other Xcode projects you dowant to use SVN with.
显然,如果您确实希望将 SVN 与其他 Xcode 项目一起使用,这可能不切实际。