Photos Framework requestImageDataForAsset occasionally fails

前端 未结 4 1849
不思量自难忘°
不思量自难忘° 2020-12-24 14:54

I\'m using the photos framework on iOS8.1 and requesting the image data for the asset using requestImageDataForAsset... Most of the time it works and I get the image data an

4条回答
  •  余生分开走
    2020-12-24 15:21

    You are likely iterating through an array, and memory is not freed timely, you can try the below code. Make sure theData is marked by __block.

    @autoreleasepool {
        [imageManager requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
            NSLog(@"requestImageDataForAsset returned info(%@)", info);
            theData = [imageData copy];
        }];
    }
    

提交回复
热议问题