Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode5 pngcrush caught libpng error

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?

like image 414
Francisco Paredes Avatar asked Jul 12 '14 16:07

Francisco Paredes


2 Answers

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.

like image 159
A.Badger Avatar answered Oct 21 '22 11:10

A.Badger


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.

like image 27
Jim Rota Avatar answered Oct 21 '22 11:10

Jim Rota