1

I'm trying to get the full-sized image data for an asset, especially when the photo is in iCloud. I want the most recent version of the image.

If the image is a JPG it's all ok, but if it's a PNG (for example a screenshot) and it is on iCloud, I receive no data and no error. If the PNG is on the device I obtain the full-sized image. To receive the PNG image from iCloud Photo I need to request the original version (PHImageRequestOptionsVersionOriginal), but I don't want the original for the JPGs.

Is there a way to request the most recent version for both JPG and PNG from iCloud? Or I'm doing something wrong?

This is my code to request the images:

PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
//options.version = PHImageRequestOptionsVersionOriginal;
options.synchronous = NO;
options.networkAccessAllowed = YES;
options.progressHandler = ^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
    if (_progressViewController != nil) {
        dispatch_async(dispatch_get_main_queue(), ^{
            if (!displayingDownload) {
                [_progressViewController show];
                displayingDownload = true;
            }
            NSLog(@"progressing...%f", progress);
            [_progressViewController setProgress:progress];
        });
    }
};

_lastRequest = [_imageManager requestImageDataForAsset:_processingAsset
                        options:options
                        resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info)
                        {
                            _imageData = imageData;
                            NSError *error  = (NSError*)[info objectForKey:PHImageErrorKey];
                        }];
asclepix
  • 7,971
  • 3
  • 31
  • 41

0 Answers0