在app中由于需要獲取圖片并展示出來(lái)绪抛,使用了requestImageDataForAsset獲取相冊(cè)照片數(shù)據(jù)崖叫,但是因?yàn)橛昧嗽瓐D的NSData來(lái)實(shí)例化了UIImage對(duì)象,造成內(nèi)存猛增,最后替換成requestImageForAsset解決問(wèn)題栈虚。
[[PHImageManager defaultManager] requestImageDataForAsset:imageAsset options:nil resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
imageView.image = [UIImage imageWithData:imageData];
}];
- (PHImageRequestID)requestImageForAsset:(PHAsset *)asset targetSize:(CGSize)targetSize contentMode:(PHImageContentMode)contentMode options:(nullable PHImageRequestOptions *)options resultHandler:(void (^)(UIImage *__nullable result, NSDictionary *__nullable info))resultHandler;