0

I have this code for retrieving an image and adding it to an array:

//Set the size of the video to 1280x720
        CGSize targetSize = CGSizeMake(1280, 720);
        PHImageRequestOptions *options = [[PHImageRequestOptions alloc]init];
        options.synchronous = YES;
        PHImageManager *manager = [[PHImageManager alloc]init];
        for (PHAsset *asset in self.assetsToVideofy){
            [manager requestImageForAsset:asset
                               targetSize:targetSize
                              contentMode:PHImageContentModeAspectFit
                                  options:options
                            resultHandler:^(UIImage *result, NSDictionary *info) {
                if (result) {
                    [self.photosToVideofy addObject:result];

                }
            }];

The problem is that the images only get added as thumbnails. How can I make sure that the image is loaded at the targetSize and then added to the array?

Thanks

Kaitis
  • 628
  • 9
  • 21

1 Answers1

1

Try change to:

if (result) {
    if (info[PHImageResultIsDegradedKey].boolValue == NO) {
        [self.photosToVideofy addObject:result];
    }
}
Joe Smith
  • 1,900
  • 1
  • 16
  • 15