4

I have came across two ideas of saving images from app to photo library.

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

  2. ALAssetsLibrary

I used the first one but it takes more time to save. Which is fast way to save images in library?

1 Answer 1

21

UIImageWriteToSavedPhotosAlbum should be faster but anyway, you should and you have to do it on a background thread to not block the main thread and the UI. Somehow like

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
   UIImageWriteToSavedPhotosAlbum(img.image, nil, nil, nil);
});
6
  • Yeah its not much fast.But it got better than previous.Thanks
    – Deepak
    Sep 18, 2013 at 7:35
  • I don't know what device you are trying but threading your app(s) should increase the performance a lot.
    – Rickye
    Sep 18, 2013 at 7:37
  • Im testing in iphone 5
    – Deepak
    Sep 18, 2013 at 7:39
  • Where does that image come from? Maybe processing the image also should be on a background thread. Also you could try monitoring the performance with Instruments to see what's taking up your CPU.
    – Rickye
    Sep 18, 2013 at 7:40
  • Its basically a very nice way to store images. Jan 22, 2014 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.