13

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

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?

Honey
  • 2,840
  • 11
  • 37
  • 71
  • 2
    Is `about2 copy.png` is correctly added into your project ? Plz check it. This should not be red. Then Clean your project and build again. – TheTiger Jul 18 '13 at 10:41
  • Yes it is added correctly and doesn't show any red colour.Yet Archive is not successful.Wht shall I do ? – Honey Jul 18 '13 at 10:42
  • Right click on this image and check, Where the Xcode where takes you. – TheTiger Jul 18 '13 at 10:45
  • It takes me to the project folder – Honey Jul 18 '13 at 10:47
  • Something wrong with `about2 copy.png`. Have you renamed it as `png` forcefully ? – TheTiger Jul 18 '13 at 10:53
  • forcefully means?But the same image is getting archived in another application . – Honey Jul 18 '13 at 10:56
  • 1
    Means you just changed the image extension while in actual it is of some other format. So open it in `preview > File > Export > save it as png`. Then Try. – TheTiger Jul 18 '13 at 10:58
  • I did like u say.But still I couldnot.Please help.Only because of images Im unable to achive the application – Honey Jul 18 '13 at 11:03
  • I made this error go away by simply opening my .png file in Windows 7 Paint, and saving it again. Job done. – Mike Gledhill Aug 08 '13 at 11:07

13 Answers13

22

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

I removed the duplicate references in my png files!

Build Phases -> Copy Bundle Resources

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

Community
  • 1
  • 1
Davide
  • 752
  • 8
  • 19
  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – BenMorel Apr 14 '14 at 11:51
  • Of course! Build Phases -> Copy Bundle Resources and removed all the duplicated entries of lunch images DefaultXX.png – Davide Apr 16 '14 at 13:46
  • In my case I found the same single pic/icon duplicate in project> target>build phase>copy bundle resources. I just delete one pic/icon and build success. – Ravi Apr 03 '19 at 19:50
13

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.

Marco Pace
  • 3,820
  • 19
  • 38
  • Did like u said.Still the error is not removed.What shall I do ? – Honey Jul 18 '13 at 11:09
  • can you try removing spaces in you file name? Before to build the application, remember to Clear you project and your Build Folder – Marco Pace Jul 18 '13 at 11:12
  • this did not work for me. removing red Copy Bundle Resource items did it instead. – AlexVPerl Feb 11 '14 at 20:05
  • This is because the user the error was on file "about2 copy.png", you don't have that file, so the error was another file - the bundle resource item. When you try to use a solution you have to implement it for your personal project. – Marco Pace Feb 12 '14 at 09:33
  • Thanks.This answer help me – inix Nov 09 '15 at 08:52
5

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

enter image description here

Amr Angry
  • 3,711
  • 1
  • 45
  • 37
2

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.

Build your project again will remove the error.

Ankur
  • 5,086
  • 19
  • 37
  • 62
2

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

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

or

Build Settings -> Search for Compress PNG Files and set to 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.

Alvin George
  • 14,148
  • 92
  • 64
1

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.

Alaa Eldin
  • 2,178
  • 4
  • 21
  • 24
0

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

Allan Macatingrao
  • 2,071
  • 1
  • 20
  • 28
0

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!

Kent Ke
  • 1,239
  • 1
  • 8
  • 6
0

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.

0

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

VARUN SINGHAL
  • 373
  • 1
  • 14
0

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

vitralyoz
  • 570
  • 7
  • 14
0

Found those images are red in color in project.Simply deleting & readding them worked.

Honey
  • 2,840
  • 11
  • 37
  • 71
-2

Just try deleting the .png extension for the files which are causing you the trouble. Don't know how, but worked for me!

codeburn
  • 1,994
  • 17
  • 20