ios 复制PNG文件错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17721177/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 00:22:59  来源:igfitidea点击:

CopyPNGFile error

iphoneiosxcode4.5

提问by Honey

When I archive the application I get CopyPNGerror for all images in my project.I tried all means deleting all the images,adding them again,check Build Phases(copy bundle resources).No duplicates are found.I couldnot understand what to do further and submit the app.When I archive another application with same images archive is successful

当我归档应用程序时,我的项目中的所有图像都出现 CopyPNG 错误。我尝试了所有方法删除所有图像,再次添加它们,检查构建阶段(复制捆绑资源)。没有找到重复项。我无法理解下一步该怎么做,提交应用程序。当我归档另一个具有相同图像的应用程序时,归档成功

CopyPNGFile "/Users/admin/Library/Developer/Xcode/DerivedData/App1-auevnkwujohdqtflzyputmxbvrmt/Build/Intermediates/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App1.app/about2 copy.png" "Classes/../about2 copy.png"
    cd "/Users/admin/Documents/App/App (1)"
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng -compress "" "/Users/admin/Documents/App/App (1)/Classes/../about2 copy.png" "/Users/admin/Library/Developer/Xcode/DerivedData/App1-auevnkwujohdqtflzyputmxbvrmt/Build/Intermediates/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App1.app/about2 copy.png"

Could not open output file /Users/admin/Library/Developer/Xcode/DerivedData/App1-auevnkwujohdqtflzyputmxbvrmt/Build/Intermediates/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App1.app/about2 copy.pngCommand /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng failed with exit code 1

What shall I do to solve this error?

我该怎么做才能解决这个错误?

回答by Davide

Solved here -> https://stackoverflow.com/a/18297130/1451462

在这里解决-> https://stackoverflow.com/a/18297130/1451462

I removed the duplicate references in my png files!

我删除了 png 文件中的重复引用!

Build Phases -> Copy Bundle Resources

and removed all the duplicated entries of lunch images DefaultXX.png

并删除了午餐图片 DefaultXX.png 的所有重复条目

回答by Marco Pace

I had the same problem, in my case the image causing the problem was a JPG renamed manually in PNG. I suggest you to open the image in a Image Editor (Gimp, Photoshop...) and save it as PNG.

我遇到了同样的问题,就我而言,导致问题的图像是在 PNG 中手动重命名的 JPG。我建议您在图像编辑器(Gimp、Photoshop...)中打开图像并将其另存为 PNG。

回答by Amr Angry

i face this problem an i solved as @Davide answer
you need to remove any reference for that image after that clean and build and problem will be fixed

我遇到了这个问题,我在@Davide 回答中解决了这个问题,
您需要在清理和构建之后删除该图像的任何引用,问题将得到解决

enter image description here

在此处输入图片说明

回答by A.G

I have this happen periodically, my solution, copy the images away, delete them from xcode, then copy them back. Fixes it every time.

我定期发生这种情况,我的解决方案是将图像复制掉,从 xcode 中删除它们,然后将它们复制回来。每次都修复它。

Delete the file reference from xcode -> click your project -> Build Phases -> Copy Bundle Resources. Then, add the file again to your project.\

从 xcode 中删除文件引用 -> 单击您的项目 -> 构建阶段 -> 复制捆绑资源。然后,再次将该文件添加到您的项目中。\

or

或者

Build Settings -> Search for Compress PNG Files and set to NO .

Build Settings -> Search for Compress PNG Files 并设置为 NO 。

or

或者

You have to save your PNG files as NOT INTERLACED. For example, by using Photoshop, go to menu File->Save For Web and Devices. Unchecked the box of 'Interlaced' and save the file. Usually interlaced box is unchecked already.

您必须将 PNG 文件保存为 NOT INTERLACED。例如,通过使用 Photoshop,转到菜单 File->Save For Web and Devices。取消选中“隔行扫描”框并保存文件。通常交错框已经取消选中。

回答by Ankur

To solve this issue open your image (about2 copy.png) in photoshop or gimp or any similar image editor. While saving(save as) your image check it as NOT INTERLACED.

要解决此问题,请在 photoshop 或 gimp 或任何类似的图像编辑器中打开您的图像 (about2 copy.png)。在保存(另存为)您的图像时,将其检查为NOT INTERLACED

Build your project again will remove the error.

再次构建您的项目将消除错误。

回答by Alaa Eldin

In my case, I just removed the "$" character from the image name. My case was that, I have image called imagex.png, then I removed that image and added one called imagex$xxx.png, then I got that error, everything went well when I just removed the dollar sign from the name.

就我而言,我只是从图像名称中删除了“$”字符。我的情况是,我有一个名为 imagex.png 的图像,然后我删除了那个图像并添加了一个名为 imagex$xxx.png 的图像,然后我得到了那个错误,当我从名称中删除美元符号时,一切顺利。

回答by Kent Ke

I had the same problem. I have fixed it. In my case. This error occurs because I have multiple files with the same name. To fix this. I delete remove the files from my project and the import again. Instead of create a group in project. I create a folder reference and everything works great as I expected!

我有同样的问题。我已经修好了。就我而言。出现此错误是因为我有多个同名文件。为了解决这个问题。我删除从我的项目中删除文件并再次导入。而不是在项目中创建一个组。我创建了一个文件夹引用,一切都按我的预期工作得很好!

回答by Kent Ke

Just remove the image file from the Xcode project, rename it as you want on FINDER and then readd it to you project. I just had this problem a while ago.

只需从 Xcode 项目中删除图像文件,在 FINDER 上根据需要重命名,然后将其读取到您的项目中。我前一段时间刚遇到这个问题。

回答by VARUN SINGHAL

This is due to copy of image of same name in Project.

这是由于在 Project 中复制了同名图像。

回答by vitralyoz

if there are icons in the exact path. you should check that all the icons are really png . just open icons in some editors and save as the icon in png format

如果在确切路径中有图标。您应该检查所有图标是否真的是 png 。只需在某些编辑器中打开图标并以 png 格式另存为图标