获取高清图导致崩溃

2017-04-10  本文已影响85人  lvzhehappy

[[PHImageManager defaultManager] requestImageForAsset:asset targetSize:CGSizeMake(200, 200) contentMode:PHImageContentModeAspectFill options:options resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {

//此处result会渲染,导致内存极高,然会发生崩溃

}];

[[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {

//将其由data转换为image就可以解决内存占有率过高的问题

UIImage * result = [UIImage imageWithData:imageData];

}];

上一篇 下一篇

猜你喜欢

热点阅读