Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

which is best to save image in the photo library?

Tags:

ios

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?

like image 576
Deepak Avatar asked Nov 30 '22 12:11

Deepak


1 Answers

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);
});
like image 143
Rickye Avatar answered Dec 05 '22 14:12

Rickye