ArcRain/AMPhotoLibrary

mainThread

Closed this issue · 5 comments

for the method
- (void)enumerateAlbums:(AMPhotoManagerAlbumEnumerationBlock)enumerationBlock resultBlock:(AMPhotoManagerResultBlock)resultBlock{
i think the resultBlock should be sent on mainThread, right?

            dispatch_async(dispatch_get_main_queue(), ^{
                resultBlock(success, error);
            });

thanks for making this library available. Great work

I think it's not MUST. Because that is not thread safety when ALAssetsLibrary and PHPhotoLibrary perform function and run callback block.

ok , the only reason i mentioned this is because the result block of the method below will make updates to the UI, which is supposed to be done on mainThread.
You can close this for now. If I encounter any issues i will let you know. Thanks

 [[AMPhotoLibrary sharedPhotoLibrary] enumerateAlbums:^(AMPhotoAlbum *album, BOOL *stop) {
      [tempArray addObject: album];
 } resultBlock:^(BOOL success, NSError *error) {
     // mainThread UI update
}];

It's a mistake in my sample code. :-) I forgot to consider thread safety in UI code.
I will do some code review again.
Thanks a lot!

thanks 👍

Add block tips in header file