无法加载“my-icon.png”从笔尖引用的图像 (iPhone)
我收到以下错误消息:
2011-02-11 14:47:13.815 myProject[13177:207] Could not load the "icon-troubleshoot.png" image referenced from a nib in the bundle with identifier "com.myCompany.myProject"
该文件是以前使用过的旧文件,但现已被删除。据我所知 icon-troubleshoot.png
没有在我的项目中的任何地方使用。我尝试清理和重建,清空缓存,但没有用。搜索字符串故障排除作为文本参考并选择“包含”,但没有返回任何内容。有谁知道我如何找到导致此错误的原因?
I am receiving the following error message:
2011-02-11 14:47:13.815 myProject[13177:207] Could not load the "icon-troubleshoot.png" image referenced from a nib in the bundle with identifier "com.myCompany.myProject"
This file is an old file that was being used before, but has now been deleted. As far as I know icon-troubleshoot.png
is not used anywhere in my project. I tried cleaning and rebuilding, emptying caches but it didn't work. Searching for the string troubleshoot as a textual reference and "contains" selected returned nothing. Does anyone know how I can find what is causing this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
该警告消息表明您的 .xib 或 .nib 文件中存在对此 png 文件的引用。
现在的问题是如何找到它。 Xcode 在这方面做得很差。在文本编辑器(如 textedit)中打开每个 nib 文件并手动搜索非常耗时。
对于此类搜索任务,我的最佳解决方案是启动终端并使用 grep 命令。转到终端中项目的源文件夹,然后您可以根据您的情况运行以下命令:
这将返回引用 my-icon.png 的所有 *.xib 文件。
稍后,当您在 xcode 中看到这些 *.xib 文件时,您会发现一个“?”登录 my-icon.png,显示该图像在您删除时确实丢失了。现在您删除了它并用另一个图像替换它。所以选择“?”标记符号,打开实用程序区域(右侧)并选择正确的文件名。仅此而已。
The warning message suggests there is a reference to this png file in your .xib or .nib file(s).
Now the question is how to find it. Xcode is poor at doing this. Opening every nib file in a text editor like textedit and manual searching is time consuming.
The best solution I have for such searching tasks is to fire up terminal and use grep command. Go to source folder of your project in terminal then you can run the following in your case:
This will return all *.xib files where my-icon.png is referenced.
Later when you will see those *.xib files in xcode you'll find a '?' sign in place of my-icon.png showing that image is indeed missing as you deleted it. Now you deleted it to replace it with another image. So select '?' mark symbol, open Utilities area (to the right) and choose the correct file name. That is all.
据我所知,x-code 的搜索工具不会在 xib 文件内搜索,这就是为什么您的搜索不会返回任何内容。无论如何,xib 文件中的某个地方很可能仍然存在引用。因为 xib 文件只是 xml,所以如果您不想手动检查所有文件,请尝试使用 TextMate 等文本编辑器打开所有 xib,并对 .png 文件名的内容执行全局文本搜索。
希望这有帮助。
再见!
as far as I know the search tool of x-code do not search inside the xib files that's why your search returns nothing. Anyway It's really probable there's still a reference in a xib file somewhere. Because xib files are just xml, if you don't want to check all them manually, try to open all your xib with a text editor like TextMate and perform a global text search over the content for the .png filename.
Hope this helps.
Ciao!
清理整个项目并重新编译。
Clean the whole project and recompile.
其中一个笔尖中必须有对此文件的引用。如果找不到它,请尝试删除使用该图像的 nib 文件,然后创建一个新文件。
另外,请检查您的捆绑包以获取对图像文件的引用。
There must be a reference to this file in one of the nibs. If you can't find it, try deleting the nib file where the image was used, and create a new one.
Also, check your bundle for a reference to the image file.
我遇到了完全相同的问题,我发现当我将此文件包含在项目中时,我没有指定我的开发和分发目标,仅指定了开发,因此当我尝试构建分发目标时,就找不到它。您必须删除对此图像的引用,然后重新添加它,并确保选中应在其中找到它的所有目标。
I had this exact same issue and I found that when I included this file in the project I didn't specify both my Development and Distribution targets, only Development, so as soon as I tried building Distribution target, it wasn't found. You have to delete reference to this image, then re-add it and make sure you checkmark all of the targets that it should be found in.
如果您只有 [email protected] 映像并运行,则可能会发生这种情况低分辨率非视网膜显示屏构建。
在您最喜欢的图像编辑器中将高度和宽度切成两半,然后将其保存在与@2x相同的文件夹中作为imageName.png
This could happen if you only have an [email protected] image and have run a low resolution non-retina display build.
Cut the height and width in half in your favorite image editor and then save it in the same folder as the @2x as imageName.png
在解决方案资源管理器中选择您的 Storyboard 对象,右键单击 Storyboard->“打开方式”->“源代码”,现在您将看到 Storyboard 中的 xml 代码。使用 Cmd+F 搜索您的图像名称并替换或删除它。
Select your storyboard object in solution explorer, right click on storyboard->"Open As"->"Source Code", now you will see xml code from storyboard. Search your image name with Cmd+F and replace or remove it.