QBImagePicker
QBImagePicker copied to clipboard
High memory problems caused flash back in iPad
I am using QBImagePicker in my project, I works well and it was very good before.
Preconditions:Just to see the album
- Image count > 1000, running on iPad.
- Access camera roll, Fast slide down , caton, than flash back then
I check on code and log, it show me this is not crash and I found received a lot of high memory warning than flash back.
Note:
- I had try to set
allowsCachingHighQualityImages
ofPHCachingImageManager
to NO, but still received memory warning. - I used demo on iPad, caton phenomenon also occurs.
Now, Can I get some help? Thanks very much.
[self.imageManager requestImageForAsset:asset
targetSize:targetSize
contentMode:PHImageContentModeAspectFill
options:nil
resultHandler:^(UIImage *result, NSDictionary *info) {
if (cell.tag == indexPath.item)
{
cell.imageView.image = result;
}
}];
[self.imageManager startCachingImagesForAssets:assetsToStartCaching
targetSize:targetSize
contentMode:PHImageContentModeAspectFill
options:nil];
I found two methods above consume more memory using Instruments.
I fixed this issue with delivery mode option. If you set delivery mode as PHImageRequestOptionsDeliveryModeOpportunistic, memory problem fixes.
Example of code:
PHImageRequestOptions *imageRequestOptions = [PHImageRequestOptions new];
imageRequestOptions.synchronous = YES;
imageRequestOptions.networkAccessAllowed = YES;
imageRequestOptions.deliveryMode = PHImageRequestOptionsDeliveryModeOpportunistic;
[self.imageManager requestImageForAsset:asset
targetSize:targetSize
contentMode:PHImageContentModeAspectFill
options: imageRequestOptions
resultHandler:^(UIImage *result, NSDictionary *info) {
if (cell.tag == indexPath.item)
{
cell.imageView.image = result;
}
}];>
@abdulkerimsahin
Cool!
But the author seems to give up maintaining the warehouse.
This is a pity that the issue of accessing iCloud
albums has not been resolved:
Set networkAccessAllowed = YES
.