How to save picture to iPhone photo library?

jblocksom picture jblocksom · Oct 7, 2008 · Viewed 159.9k times · Source

What do I need to do to save an image my program has generated (possibly from the camera, possibly not) to the system photo library on the iPhone?

Answer

Martin Gordon picture Martin Gordon · Oct 7, 2008

You can use this function:

UIImageWriteToSavedPhotosAlbum(UIImage *image, 
                               id completionTarget, 
                               SEL completionSelector, 
                               void *contextInfo);

You only need completionTarget, completionSelector and contextInfo if you want to be notified when the UIImage is done saving, otherwise you can pass in nil.

See the official documentation for UIImageWriteToSavedPhotosAlbum().