从 Xcode 中的存储库中删除未引用的图像

发布于 2024-11-13 04:31:18 字数 201 浏览 1 评论 0原文

我从资源文件夹中删除了 default.png,因为我想要为加载屏幕使用不同的图像,但我只是删除了引用,这显然是一件愚蠢的事情。我将新图像拖到资源中并尝试将名称更改为 Default.png,但它不允许我这样做,我认为这是因为第一个 Default.png 仍在存储库中的某个位置。不管怎样,当它在 xcode 中不再可见时,如何从存储库中删除该图像(以及其他我可能做过同样事情的图像)?

I deleted default.png from my resources folder because I wanted a different image for the loading screen, but I just deleted the reference which was apparently a dumb thing to do. I dragged the new image into resources and tried to change the name to Default.png, but it won't let me, which I think is because the first Default.png is still in the repository somewhere. Anyway, how do I delete that image(and others with which I have probably done the same thing) from the repository when it is no longer visible in xcode?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

此生挚爱伱 2024-11-20 04:31:18

它是什么样的存储库?颠覆?吉特?

Xcode 中的 SCM 集成非常适合检查文件和提交更改,而无需离开 IDE,但它并不是 svn 或 git 的成熟 GUI 前端。可以通过将文件添加回项目然后在 Xcode 中删除它来修复您的错误,这样 Xcode 就会为您将其从存储库中删除,但简单的解决方案是从存储库中删除该文件您自己使用适当的版本控制命令。例如,如果您使用 Subversion,您可以:

svn remove default.png

从您的存储库版本中删除该文件。当您提交更改时,该版本中的文件将被删除。 (它仍然存在于以前的版本中——毕竟,这就是 SCM 的全部意义。)

之后,您可以创建新文件并以通常的方式将其添加到项目和存储库中。

What kind of repository is it? Subversion? Git?

The SCM integration in Xcode is great for checking out files and committing changes without having to leave the IDE, but it's hardly a full-blown GUI front end to either svn or git. It may be possible to fix your mistake by adding the file back to the project and then deleting it in Xcode in such a way that Xcode will remove it from the repository for you, but the simple solution is to just delete the file from the repository yourself by using the appropriate version control command. For example, if you're using Subversion you could:

svn remove default.png

to remove the file from your version of the repository. When you commit your changes, the file will be deleted in that version. (It'll still exist in previous versions -- that's the whole point of SCM, after all.)

After that, you can create the new file and add it to both the project and the repository in the usual way.

林空鹿饮溪 2024-11-20 04:31:18

您需要手动进入应用程序的文件结构并删除图像文件本身。此外,每当您从 XCode 项目中删除文件或对文件的引用时,“清理”应用程序通常是一个好主意,因为 XCode 在删除文件方面可能有点不稳定;其组合键是

希望这可以解决您的问题。

You need to manually go into your app's file structure and delete the image files themselves. Also, it is usually a good idea to "clean" the app whenever you remove files or references to files from an XCode project, since XCode can be a bit temperamental about removing files; the key combination for this is

Hope this fixes your problem.

情深缘浅 2024-11-20 04:31:18

清理所有目标应该有效(至少对我有用)。您可以尝试以下方法:
a) 从目标的“复制捆绑资源”中删除引用
b) 从模拟器/设备中删除应用程序
c) 清理所有目标

Clean all targets should work (at least it worked for me). You can try the following:
a) delete the reference from "Copy Bundle resources" of your target
b) delete the app from Simulator/Device
c) clean all targets

你在我安 2024-11-20 04:31:18

迦勒是绝对正确的。这也解决了大多数文件的问题。

概述意外未删除的文件的一种更简单的方法是使用版本(SVN 软件 - 如果您使用 SVN)创建工作副本的书签。您可以在那里以图形方式检测有问题的文件并将其删除。我总是必须在重组项目文件夹后执行此操作。

Caleb is absolutely right. That fixed the problem here as well for the most files.

An easier way to get an overview of the accidentally un-deleted files, is creating a bookmark of the working copy with Versions (SVN Software - in case you use SVN). There you can detect the problematic files grafically and delete them. I always have to do this after restructuring the project folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文