Not a PNG filCommand copypng emitted errors but did not return a nonzero exit code to indicate failure

StackOverflow https://stackoverflow.com/questions/13679710

Question

I am getting following error while adding images the running the project on iPad. It worked fine on simulator with all images but on iPad its running but showing no images.

CopyPNGFile /Users/user/Library/Developer/Xcode/DerivedData/RImageGallery-cmwaittvclhwgxfpcoarddipyliv/Build/Products/Debug-iphoneos/RImageGallery.app/Default.png PhotoBrowserDemo/Default.png
    cd /Users/user/Desktop/Demo
    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/user/Desktop/Demo/PhotoBrowserDemo/Default.png /Users/user/Library/Developer/Xcode/DerivedData/RImageGallery-cmwaittvclhwgxfpcoarddipyliv/Build/Products/Debug-iphoneos/RImageGallery.app/Default.png

   Not a PNG filCommand /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng emitted errors but did not return a nonzero exit code to indicate failure




(null): While reading /Users/user/Desktop/Demo/PhotoBrowserDemo/Default.png pngcrush caught libpng error:




(null): Could not find file: /Users/user/Library/Developer/Xcode/DerivedData/RImageGallery-cmwaittvclhwgxfpcoarddipyliv/Build/Products/Debug-iphoneos/RImageGallery.app/Default.png




Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng emitted errors but did not return a nonzero exit code to indicate failure
Was it helpful?

Solution 2

Case 1: Format difference

It worked when i changed the images from jpg to png, using Preview. Previously It might not be working due to .png as name only not as format. This link helped.

Also to convert the multiple images to png in a folder in single step use terminal. Using cd goto the folder containing the images (JPGs or any type). run Code:

mkdir pngs; sips -s format png *.* --out pngs

It will convert your images to .png and will create a pngs folder contain the converted images.

Case 2: Two images with same name or one image added twice:

As Rajneesh071 & Himanshu suggested: There can be two or more images with same name or two targets were added for same image. Goto project target ->Build Phases -> Copy Bundle Resources and search for your image file name. and remove the repeated file.

OTHER TIPS

MY ANSWER:

I had this problem. Two targets were added for same image. Goto project target ->Build Phases -> Copy Bundle Resources and search for your image file name.

Most likely there are two entries. Remove one.

By doing so I got resolved my problem.This works for me :) :)

HAPPY TO HELP :) :)

I'm hoping to give more visibility to @Rajneesh071's comment. In my case, there was more than one Default.png file in my project. When I first created my project, Xcode put Default.png (and other splash screen png files) in my project. After creating my own splash screen, and adding them to the project through Xcode, I started getting the weird png crush errors. After trying many different answers, I came across Rajneesh071's comment that more than one Default.png existed. Did a quick filter on Default and sure enough, the Xcode provided Default files where listed along with my own. Deleted the Xcode provided Default*.png files and no more pngcrush errors.

If you find this useful, please give an uptick to Rajeneesh071's comment on the original question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top