Commit 6b07cc52 authored by maji's avatar maji

fix 内存泄漏(当targetSize传值为PHImageManagerMaximumSize时,...

fix 内存泄漏(当targetSize传值为PHImageManagerMaximumSize时, requestImageForAsset方法调用会产生内存泄漏. 用"requestImageDataForAsset"方法替换)
parent ba97a4a2
......@@ -467,10 +467,10 @@ static dispatch_once_t onceToken;
[option setProgressHandler:progressHandler];
}
option.resizeMode = PHImageRequestOptionsResizeModeFast;
return [[PHImageManager defaultManager] requestImageForAsset:asset targetSize:PHImageManagerMaximumSize contentMode:PHImageContentModeAspectFit options:option resultHandler:^(UIImage *result, NSDictionary *info) {
return [[PHImageManager defaultManager] requestImageDataForAsset:asset options:option resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
BOOL cancelled = [[info objectForKey:PHImageCancelledKey] boolValue];
if (!cancelled && result) {
result = [self fixOrientation:result];
if (!cancelled && imageData) {
UIImage *result = [self fixOrientation:[UIImage imageWithData:imageData]];
BOOL isDegraded = [[info objectForKey:PHImageResultIsDegradedKey] boolValue];
if (completion) completion(result,info,isDegraded);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment