Search code examples
iphoneiosipadios6default.png

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


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

Solution

  • 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.