iPad:PNG 粉碎错误
我正在尝试将我的 iPad 项目移植到最新的 iPad 2。我使用 Xcode 4.0 安装了 iOS 4.3 SDK。当我尝试构建我的项目时,出现以下错误。我不知道为什么我会收到此错误。有人可以帮我解决这个构建错误吗?
在读取 /Users/username/Desktop/iPAD/MyProject/trunk/Resourses/images/top_bar.png pngcrush 时捕获 libpng 错误: 不是 PNG 文件..
找不到文件:/Users/username/Library/Developer/Xcode/DerivedData/Project-fmhveawksgdtnraclfizuhrekmzi/Build/Products/Debug-iphoneos/MyApp-Upgraded.app/top_bar.png
I am trying port my iPad project to latest iPad 2. I installed iOS 4.3 SDK with Xcode 4.0. When i try to build my project, i'm getting the following error. I don't know why am i getting this error. Could someone help me to resolve this build error?
While reading /Users/username/Desktop/iPAD/MyProject/trunk/Resourses/images/top_bar.png pngcrush caught libpng error:
Not a PNG file..
Could not find file: /Users/username/Library/Developer/Xcode/DerivedData/Project-fmhveawksgdtnraclfizuhrekmzi/Build/Products/Debug-iphoneos/MyApp-Upgraded.app/top_bar.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(15)
图像或 Xcode 没有问题。从 Photoshop 创建该图像的问题是该图像是否隔行扫描或非隔行扫描。在 Photoshop 中保存图像时,您将获得一个选项。
查看此链接以获取更多信息:
使用 Xcode 4 构建应用程序 - 它总是显示一些有关 PNG 图像的错误
非隔行扫描: 您应该使用非隔行扫描的图像。这是原始的 png 图像。
交错:此选项适用于从网络下载的图像。具体来说,当您需要减少图像加载时间时使用此功能。此选项的内部作用是,它将创建一个 .png 文件,但其清晰度和 dpi 较低,就像普通的 jpeg 图像一样。这就是为什么此类图像具有 jpeg 图像属性。
希望这会对大家有所帮助。
享受编码的乐趣:)
There is no issues with image or Xcode. The issue, which creating that image from photoshop, is whether that image is interlaced or not interlaced. While saving your image in photoshop you will get one option for that.
Check out this link for more info:
Build app with Xcode 4 - it always show some error about PNG image
not interlaced: You should use image which is not interlaced. This is the original png image.
interlaced: This option is suitable for the image which are getting downloaded from web. Specifically saying, this is used when you require to reduce image load time. What this option internally does is, it will create a .png file but with lower clarity and lower dpi like a normal jpeg image. That's why such images are having property that it is jpeg image.
Hope this will help you all.
Enjoy Coding :)
当我将项目文件夹中的图像移动到“图像”文件夹时,出现此错误。
事实证明,我的“复制资源”构建阶段包含从新的正确文件夹以及存储文件的先前文件夹复制文件的步骤。删除过时的构建步骤修复了错误。
I got this error when I moved images around in the project's folder, to an "Images" folder.
Turns out my "Copy Resources" build phase contained the steps both to copy the files from their new, correct folder - and from the previous folder where they were stored. Removing the outdated build steps fixed the errors.
pngcrush 认为 PNG 文件不是真正的 PNG 文件的另一个原因是,如果您不小心导出它们时图层完好无损。如果您在 Finder 中检查文件,请在“更多信息”区域(尺寸、色彩空间等)中查找名为“图层”的项目,
它可能会显示如下内容:
Layer 68、Title Banner、Group 26
当设计师有时另存为 PNG 而不是导出到 Web/移动设备时,就会发生这种情况。它完全摧毁了 libpng(以及 pngcrush)。
解决方法是正确导出 PNG,或者自己打开 PNG 并将其重新导出为“平面”PNG。
Another reason pngcrush considers PNG files to not really be PNG files is if you accidentally export them with layers intact. If you inspect the file in Finder, look around the More Info area (Dimensions, Color Space, etc.) for an item called "Layers"
It might say something like:
Layer 68, Title Banner, Group 26
This happens when designers sometimes Save As PNG instead of exporting for web/mobile. And it completely destroys libpng (and thus pngcrush).
The fix is to properly export the PNG, or open the PNG yourself and re-export it as a "flat" PNG.
这可能是由于 PNG 文件格式不兼容造成的。您将需要 png 文件的“颜色配置文件”才能使其在 Xcode 中工作。
首先,检查您的文件的信息。
虽然这是一个有效的 PNG 文件,但这不是 Xcode 可以采用的格式。您将需要以下 PNG 格式:
将 PNG 文件转换为 Xcode 可以采用的格式。您可以使用预览来导出文件。
This can be caused by incompatible PNG file format. You will need the "Color profile" for your png file to make it work in Xcode.
First off, check the info for your file.
While this is a valid PNG file, this is NOT the format that Xcode can take. You will need the following PNG format:
To convert your PNG file to a format that Xcode can take. You can use Preview to export the file.
也有这个问题。巴布亚新几内亚存在并且没有腐败。
解决方法:
Had this issue as well. The PNG existed and wasn't corrupt.
Solved it by:
我遇到这个问题,发现png有问题。我重新制作了它并且工作得很好。
I had this problem and found there was a problem with the png. I remade it and worked fine.
我也有同样的问题。尽管文件扩展名可能是 png,但文件仍可能是其他名称。 “获取信息”显示了我认为的文件扩展名。在预览中打开文件并转到工具 ->显示检查员->文件选项卡。在这里您应该能够看到实际的文件类型。
I had the same problem. Even though the file extension may be png the file may still be something else. And 'get info' shows what ever the file extension is I think. Open up the file in preview and go to tools -> show inspector -> File tab. Here you should be able to see the actual file type.
我遇到了这个错误,它实际上与它出错的 png 完全无关。实际的问题是我的项目中有两个同名的文件(我拖放了一个较新版本的第 3 方类,假设它将替换旧版本)。
我删除了对重复文件的引用并解决了构建错误。
I had this error and it was actually totally unrelated to the png's it was erroring on. The actual problem was I had two files with the same name in my project (I had drag'n'dropped a newer version of a 3rd party class assuming it would replace the older version).
I removed the reference to the duplicate file and that solved the build errors.
问题已解决
我在开发过程中遇到了几次同样的问题,但今天我发现有两种解决方案及其可能性,这是这个
尽情享受吧。
Problem Solved
I got the same problem couple of time in development but today i found that there are two solutions and their possibilities, here is this
Just Enjoy.
当我尝试复制项目文件夹并运行项目时,出现同样的错误。原来文件夹中的项目没有这个问题。
删除副本并制作文件夹的新副本解决了我的问题。
I get the same error when I tried to copy my project folder and run the project. The project in the original folder didn't have that problem.
Deleting the copy and making a new copy of the folder solved my problem.
错误:
解决方案:
这就是它的全部工作,就像魅力
希望这会对某人有所帮助。
Error:
Solution:
That's All its work like charm
Hope this will help someone.
我经常遇到这个错误。如果你 100% 确定你的 png 在那里并且是正确的,那么只需重新编译项目,如果不起作用 - 一次又一次地重新编译,有时它会开始工作;-) 这是 Xcode 中长期存在的错误(从 Xcode3 开始)。
I have this bug quite often. if you 100% sure that your png is there and is correct then just simply recompile the project, if does not work - recompile again and again, and sometimes it will start working ;-) that's a bug in Xcode that was there for long time (since Xcode3).
我遇到了同样的问题,但这并不是因为 png 损坏:而是因为两个 PNG 文件在我的源树的不同目录中具有相同的文件名。奇怪的是,一个版本与另一个版本的错误(我有 4 个具有“双胞胎”的文件)并不相同。在一次运行中,所有文件都出现错误,而在另一次运行中,只有其中一些文件出现错误。
I had the same problem, but it wasn't because of a corrupted png : it was because two PNG files had the same filename in different directories of my source tree. What was peculiar was that the errors (I had 4 files which had "twins") were not identical from one build to another. On one run I had errors on all files, on the other only on some of them.
您是否检查了文件
Users/kavapanga/Desktop/iPAD/ALN II 3latest 2/trunk/Resourses/images/CS_logo_for_top_bar.png
是否存在?还要检查它是否实际上是 PNG 文件。右键单击该文件并执行“获取信息”以检查该文件是否具有任何其他扩展名并被标记为隐藏扩展名。如果您不确定文件的格式,大多数情况下,打开文件并再次将其另存为 PNG 文件应该可以。Did you check whether the file
Users/kavapanga/Desktop/iPAD/ALN II 3 latest 2/trunk/Resourses/images/CS_logo_for_top_bar.png
exists? Also check if it is infact a PNG file. Right click on the file and do a Get Info to check if the file has any other extension and is marked as hide extension. If you are not sure of the format of the file, opening the file and save it as a PNG file again should work ,most of the time.我也有同样的问题。
如何修复:使用预览打开图像 ->文件>出口>格式更改为PNG,就完成了!
I had the same problem.
How to fix : Open up image with Preview -> File > Export > Format change to PNG and you are done !!