Breaking News
Home / iOS / iOS Snippets / PNG Crush Build Error in iOS

PNG Crush Build Error in iOS

Xcode PNG Crush ErrorPNG is preferred image format for iOS applications due to benefits of PNG over other image formats like JPG,GIF etc. When an iOS project is build using XCode, the compiler recognizes the PNG image files and tries to compress them and include into the deployment artifact(app). Sometimes the file extension may say png but it may not be a encoded as true png, in that case the build gives a warning:

/activity.png pngcrush caught libpng error:
   Not a PNG file..

Due to which the file does not get included in the app and will show up as blank/missing image when you run the app on the device, however it might show up in the simulator.

<!>

Exception in Logs

copyPNGFile /Users/mvohra/Library/Developer/Xcode/DerivedData/Contacto-eywuivtyenvnrkfyhrckvsezbxat/Build/Products/Debug-iphoneos/Contacto.app/activity.png images/activity.png
    cd /Users/mvohra/workspace/projects/iphone/contacto
    setenv PATH “/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin”
    “/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/PrivatePlugIns/iPhoneOS Build System Support.xcplugin/Contents/Resources/copypng” -compress “” /Users/mvohra/workspace/projects/iphone/contacto/images/activity.png /Users/mvohra/Library/Developer/Xcode/DerivedData/Contacto-eywuivtyenvnrkfyhrckvsezbxat/Build/Products/Debug-iphoneos/Contacto.app/activity.png

While reading /Users/mvohra/workspace/projects/iphone/contacto/images/activity.png pngcrush caught libpng error:
   Not a PNG file..

Could not find file: /Users/mvohra/Library/Developer/Xcode/DerivedData/Contacto-eywuivtyenvnrkfyhrckvsezbxat/Build/Products/Debug-iphoneos/Contacto.app/activity.png

Resolution

Find all the files mentioned as error by the compiler, open these in a photo editor like PaintBrush, SeaShore etc. and save them as PNG. The editor would encode these in png format. Then do the build again, deploy on the device and try it out.


[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Advertisment ad adsense adlogger