Xcode5 pngcrush caught libpng error

20.3k Views Asked by At

I am looking to complete an app I have created within xcode5. When I run it with the simulator everything goes smoothly with no errors, but when I try to archive the app I get countless amounts of errors in regards to the images in the project. Many of the are flagged with the text "pngcrush caught lilpng error.

All my images are png files and when I finish the project being archived even with the errors some images come thru while others are left blank. Any suggestions or pointers?

6

There are 6 best solutions below

1
Aggressor On

If you have images in your images.xcassets AND the raw images linked, it runs into this issue. Delete the references to the images (keep the images.xcassets). Will fix the problem

0
A.Badger On

You can stop XCode shrinking images with pngcrush by going into Your App -> Build Settings and setting "Compress PNG Files" to No.

This stops pngcrush running at all, but will also likely result in bigger images. Ensure there isn't a genuine problem with your PNGs before doing this.

Backstory: I've had similar issues with pngcrush /libpng crashing with PNGs (checksum errors / freeing object that have been freed etc). These could be reproduced on the command line so I recreated the PNGs, even converted them to other formats then back but the errors persisted. In my case Xcode then rejected the resulting archive for not having iPhone 5 support (as pngcrush killed the [email protected] image). The above fix resolved this.

0
Neeraj Soni On

I am also facing the same problem in Xcode5 pngcrush caught libpng error,

just quick fix: i checked the png files which i was adding(reading) using xcode. Actually png file is having content error(png was corrupted file), so i changed the png files, and upload, now it is working.

2
Jim Rota On

In my case I had 2 image files in the project with the same name and the error actually was telling me which files were problematic (without saying there were 2 files with the same name) but I arrogantly thought it was something else! After growing tired of the error, I did more investigation into those particular files and it was obvious which ones were from a previous build and were now not intended (hence could be deleted). Once I deleted the "older" images this error went away.

0
Swati Gupta On

I resolved it by opening that image in Preview and exporting it to png and replacing the image in Xcode with the new one.

0
Smbat Tumasyan On

I resolved it by opening that image in Preview and exporting it to png without alpha and replacing the image in Xcode with the new one.