I spent a lot of time on this code, and I could not find the right solution. Apparently, the problem arose on github, and the user suggested a fix:
https://github.com/arturgrigor/AGImagePickerController/issues/19
But apparently, he just deleted all the blocks working in the background, so I believe that for a large number of images the performance will be poor.
My guess is that inside the dispatch_async block, code is executed that calls some UIKit function, and therefore the behavior is mostly undefined.
For example, it seems to me that the setAsset function in AGIPGridItem.m is called inside the dispatch_async you sent. It calls UImage, and although it is inside a lock, it should still execute in the background thread, while all UIKit code should execute on the main one.
UITableViewCell loadable images and reusable cells
But even if I end the call inside dispatch_async(dispatch_get_main_queue()...) , it still doesn't work.
It seems like calling [view removeFromSuperview]; in setItems in AGIPGridell.m somehow responds, but deleting it has a side effect of creating a memory leak (unsurprisingly).
vinaut
source share