Xcode5 pngcrush caught libpng error

Francisco Paredes picture Francisco Paredes · Jul 12, 2014 · Viewed 20.2k times · Source

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?

Answer

A.Badger picture A.Badger · Jan 22, 2015

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.