iPad:PNG 粉碎错误

发布于 2024-10-25 00:21:06 字数 437 浏览 5 评论 0原文

我正在尝试将我的 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 技术交流群。

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

发布评论

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

评论(15

佞臣 2024-11-01 00:21:07

图像或 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 :)

淡看悲欢离合 2024-11-01 00:21:07

当我将项目文件夹中的图像移动到“图像”文件夹时,出现此错误。

事实证明,我的“复制资源”构建阶段包含从新的正确文件夹以及存储文件的先前文件夹复制文件的步骤。删除过时的构建步骤修复了错误。

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.

送君千里 2024-11-01 00:21:07

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.

荭秂 2024-11-01 00:21:07

这可能是由于 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.

enter image description here

While this is a valid PNG file, this is NOT the format that Xcode can take. You will need the following PNG format:

enter image description here

To convert your PNG file to a format that Xcode can take. You can use Preview to export the file.

叹沉浮 2024-11-01 00:21:07

也有这个问题。巴布亚新几内亚存在并且没有腐败。

解决方法:

  1. R-单击 xcode 中的图像,选择“删除”
  2. 仅删除引用(实际上并不删除文件)
  3. 将其拖回 xcode(就地),确保选择正确的目标

Had this issue as well. The PNG existed and wasn't corrupt.

Solved it by:

  1. R-click the image in xcode, select "Delete"
  2. Remove reference only (don't actually trash the file)
  3. Drag n' drop it back into xcode (in-place) making sure you select the correct targets
云朵有点甜 2024-11-01 00:21:07

我遇到这个问题,发现png有问题。我重新制作了它并且工作得很好。

I had this problem and found there was a problem with the png. I remade it and worked fine.

夏の忆 2024-11-01 00:21:07

我也有同样的问题。尽管文件扩展名可能是 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.

折戟 2024-11-01 00:21:07

我遇到了这个错误,它实际上与它出错的 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.

对你再特殊 2024-11-01 00:21:07

问题已解决

我在开发过程中遇到了几次同样的问题,但今天我发现有两种解决方案及其可能性,这是这个

问题已解决#1:如果您创建或您的设计师创建了他们从 adobe illustrator 中保存 pnd 的设计,那么如果您自己创建,只需将所有 AI 图稿复制到 Photoshop,或者如果您的设计师创建它,就会出现问题然后告诉他们将 illustrator 格式导入到 Photoshop 中并发送 pnd。

问题解决#2:选择图像,右键单击图像 -> 获取信息并检查其是否为正确的 .png 格式,如果不正确,则只需编辑 .png 扩展名。

尽情享受吧。

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

Problem Solved#1: If you Create or your designer create the design which they saved the pnd from adobe illustrator then its got the problem if you create by yourself just copy all the AI artwork to the photoshop or if your designer create it then just tell them to import the illustrator format to the photoshop and send the pnd.

Problem Solved#2: select the image right click the image->get Info and check that it is in correct .png format or not if its not then just edit .png extension.

Just Enjoy.

旧人九事 2024-11-01 00:21:07

当我尝试复制项目文件夹并运行项目时,出现同样的错误。原来文件夹中的项目没有这个问题。

删除副本并制作文件夹的新副本解决了我的问题。

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.

梦在深巷 2024-11-01 00:21:07

错误:

在阅读 /Volumes/Mac OS/RDC/Workpot/RestApp/RestApp/default1024_768.png pngcrush 时捕获
libpng 错误:不是 PNG 文件..

解决方案:

  1. 我在 PaintBrush 工具和同名的另存为 PNG 文件。
  2. 替换了Xcode项目中的图标文件 -->清洁-->建造。

这就是它的全部工作,就像魅力

希望这会对某人有所帮助。

Error:

While reading /Volumes/Mac OS/RDC/Workpot/RestApp/RestApp/default1024_768.png pngcrush caught
libpng error: Not a PNG file..

Solution:

  1. I opened "default1024_768" file in PaintBrush tool and saveAs PNG file with same name.
  2. Replaced the Icon file in Xcode project --> Clean --> Build.

That's All its work like charm

Hope this will help someone.

水染的天色ゝ 2024-11-01 00:21:07

我经常遇到这个错误。如果你 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).

安稳善良 2024-11-01 00:21:06

我遇到了同样的问题,但这并不是因为 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.

伪心 2024-11-01 00:21:06

您是否检查了文件 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.

我乃一代侩神 2024-11-01 00:21:06

我也有同样的问题。
如何修复:使用预览打开图像 ->文件>出口>格式更改为PNG,就完成了!

I had the same problem.
How to fix : Open up image with Preview -> File > Export > Format change to PNG and you are done !!

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