如何让 Xcode 刷新其项目图像文件的本地副本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/403645/
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
How do I make Xcode refresh its local copies of my project's image files?
提问by jpm
I'm having some weird issues with Xcode, and this is pretty much impossible to find answers by simply googling around.
我在使用 Xcode 时遇到了一些奇怪的问题,通过谷歌搜索几乎不可能找到答案。
I have a few icon image files (just PNGs) in my Xcode project, and when I modify some of them in Photoshop, they don't get updated when I do another build in Xcode. In order to fix this I have to re-add the file again to the project, and then remove the old version of the file that is already in there in Xcode.
我的 Xcode 项目中有一些图标图像文件(只有 PNG),当我在 Photoshop 中修改其中一些时,当我在 Xcode 中进行另一个构建时,它们不会更新。为了解决这个问题,我必须再次将文件重新添加到项目中,然后删除 Xcode 中已有的旧版本文件。
What am I doing wrong here? I'm updating/replacing the image file that is stored in my project's directory directly from Photoshop, so I assumed that it would just get reloaded and the new version would show up.
我在这里做错了什么?我正在直接从 Photoshop 更新/替换存储在我的项目目录中的图像文件,所以我假设它会重新加载并且新版本会出现。
UPDATE: Looks like what happened was that when I first imported the image files into my project, they got added to my "Classes/" sub-directory. So when I was updating them, it was just adding them to the root of my project.
更新:看起来发生的事情是当我第一次将图像文件导入我的项目时,它们被添加到我的“Classes/”子目录中。所以当我更新它们时,只是将它们添加到我的项目的根目录中。
采纳答案by sammich
That's pretty weird. I'd suggest two things:
这很奇怪。我建议两件事:
Check that you're not saving your photoshop files into the wrong directory. I know this seems straightforward but its worth a check. Make sure you're not saving them into the build/ directory or anything like that.
Before running again in the simulator, try cleaningall build targets first to ensure that your project actually builds again before launching the simulator.
检查您没有将 Photoshop 文件保存到错误的目录中。我知道这看起来很简单,但值得一试。确保您没有将它们保存到 build/ 目录或类似的目录中。
在模拟器中再次运行之前,先尝试清理所有构建目标,以确保在启动模拟器之前您的项目实际再次构建。
回答by vedran
I had the exact same problem. The following fixed it for me: In Xcode, go to Project --> Clean
我有同样的问题。以下为我修复了它:在 Xcode 中,转到 Project --> Clean
This will purge the old images from xcode cache and will show your new image
这将从 xcode 缓存中清除旧图像并显示您的新图像