How to save picture to iPhone photo library?

camera, cocoa-touch, ios, iphone, uiimage

Solution

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()`.

Problem

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?

Original source

Related problems