获取高清图导致崩溃

[[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];

}];

你可能感兴趣的:(获取高清图导致崩溃)