Unverified Commit d5ae7b77 authored by 谭真's avatar 谭真 Committed by GitHub

Merge pull request #1449 from macMaJi/master

fix 内存泄漏
parents ba97a4a2 6b07cc52
...@@ -467,10 +467,10 @@ static dispatch_once_t onceToken; ...@@ -467,10 +467,10 @@ static dispatch_once_t onceToken;
[option setProgressHandler:progressHandler]; [option setProgressHandler:progressHandler];
} }
option.resizeMode = PHImageRequestOptionsResizeModeFast; 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]; BOOL cancelled = [[info objectForKey:PHImageCancelledKey] boolValue];
if (!cancelled && result) { if (!cancelled && imageData) {
result = [self fixOrientation:result]; UIImage *result = [self fixOrientation:[UIImage imageWithData:imageData]];
BOOL isDegraded = [[info objectForKey:PHImageResultIsDegradedKey] boolValue]; BOOL isDegraded = [[info objectForKey:PHImageResultIsDegradedKey] boolValue];
if (completion) completion(result,info,isDegraded); 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