Which is best stored in a photo library?

I came up with two ideas for saving images from an application to a photo library.

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

I used the first, but it takes more time to save. I want to know what a quick way to save images in a library.

+4
source share
1 answer

UIImageWriteToSavedPhotosAlbum should be faster, but in any case you need, and you should do this in the background thread so as not to block the main thread and the user interface. Something like

 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ UIImageWriteToSavedPhotosAlbum(img.image, nil, nil, nil); }); 
+21
source

Source: https://habr.com/ru/post/1502736/


All Articles