I’m trying to link the libpng library to my iphone application, and getting this error:
ld: warning: in /opt/local/lib/libpng.dylib, file is not of required architecture
This happens when I build for the simulator or the device.
When I build a console application however, I can link in libpng just fine.
What am I doing wrong? Is there a different libpng.dylib I need to use for iphone development?
As Chris Long says, libpng is not available on the iphone. You can compile it into your project (if it will compile for ARM), otherwise it no workums.
Here is a lead: http://www.cloudgoessocial.net/2009/06/09/imagemagick-on-iphone-with-jpeg-png/
Also, for the record, you can write out a UIImage as png natively using:
UIImagePNGRepresentation(UIImage *image)