如何删除 Xcode 文件的引用?
不久前,我从我的 iOS 项目中删除了一些文件,并认为它们已被完全删除。很长一段时间后,我创建了另一个类,不幸的是,它与我从项目中删除的类同名(但引用和文件都已被删除)。
长话短说,我的项目尝试使用对旧文件的引用,所以我通过查找器删除了冲突的文件。这就解决了引用哪个类的问题。但是对已删除文件的引用会导致 Xcode 发出警告,给出“丢失文件”消息。
有谁知道如何删除旧的引用以消除此警告?
I had removed some files from my iOS project a while back and thought they had been completely deleted. After a long time I created another class which unfortunately had the same name as one of those that I had removed from my project (but the reference nor the file had been removed).
To make the long story short, my project tried using the reference to the old file, so I went through finder to delete the conflicting files. That solved the issue of which class was being reference. But the reference to the deleted files cause a warning in Xcode giving me a Missing File message.
Does anyone know how I can remove the old references in order to get rid of this warning?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
由于需要删除对这些文件的引用,我尝试以与手动删除的文件相同的名称再次创建文件,并通过 Xcode 再次删除它们,并从弹出窗口中选择删除引用。
Since the reference to those files needed to be removed, I tried creating the files again under the same name as those that I had removed manually and deleted them again through Xcode and selected remove references from the pop up.
删除子项目后,我的代码中总是引用该框架。
要删除这个框架,我必须执行以下步骤:
使用在 applescript 工具中运行的脚本删除所有派生和缓存的数据:
After removing a subproject, the framework was always referenced in my code.
To remove this framework I had to do these steps:
remove all derived and cached data with this script run in applescript tool :
就我而言,添加和删除外部框架以及使用 Clean 并没有解决问题。前往目标>构建设置>搜索路径并从框架搜索路径和库搜索路径中删除有问题的路径就可以了。
In my case, adding and removing the external frameworks and using Clean did not solve the problem. Going to Target > Build Settings > Search paths and removing the offending paths from Framework Search Paths and Library Search Paths did the trick.
我今天遇到了同样的问题。由于 git merge 问题,我最终删除了一个图像文件,但对它的引用仍然存在。澄清一下,我的目的是删除该图像。
解决此问题的简单方法是使用 vim 或其他文本编辑器
,搜索您删除的文件的名称,然后删除其中的所有搜索结果。
I hit the same issue today. Due to git merge issue, I ended up with a image file removed, but reference to it still exists. To clarify, My intention was to remove the image.
The simple way to fix this would be using vim, or other text editors
and do a search on the name of the file you deleted and just delete all search results there.
转到项目> 构建阶段 > 编译资源并选择引用的类并点击“-”。这将删除引用,然后再次构建。
Go to Project > Build Phases > Compile Resources and select referenced Class and hit "-" .this Will delete reference And now Build Again.
为了避免此错误,请确保在对该文件进行任何更改(在 XCode 之外)之前先对该文件进行
删除引用
,例如在文件夹中删除、重命名等。要删除引用,请在 XCode 中,右键单击该文件,然后
删除
。将显示一个弹出窗口,询问您是否要移至垃圾箱
或删除引用
。但是,如果您在 XCode 上执行“删除”之前进行了任何更改,该弹出窗口将不会显示。
只是一个提示!
To be safe from this error, make sure you
Remove Reference
on the file first before making any changes (outside XCode) on that file like deleting in folder, renaming, etc..To remove reference, in XCode, right click on the file then
Delete
. A pop-up will show asking if you want tomove to trash
orremove reference
.However, that popup won't show if you made any changes before doing Delete on XCode.
Just a tip!