1and2papa / CTAssetsPickerController

iOS control that allows picking multiple photos and videos from user's photo library.
MIT License
2.15k stars 550 forks source link

use PHImageManager requestImageForAsset method can't get origin image from cloud #190

Closed qylibohao closed 8 years ago

qylibohao commented 8 years ago

i use the phimagemager to request the image form cloud, the request options is below: self.requestOptions = [[PHImageRequestOptions alloc] init]; self.requestOptions.version = PHImageRequestOptionsVersionCurrent; self.requestOptions.resizeMode = PHImageRequestOptionsResizeModeFast; self.requestOptions.deliveryMode = PHImageRequestOptionsDeliveryModeOpportunistic; self.requestOptions.networkAccessAllowed = YES; self.requestOptions.synchronous = YES;

    [manager requestImageForAsset:asset
                       targetSize:PHImageManagerMaximumSize
                      contentMode:PHImageContentModeAspectFill
                          options:self.requestOptions
                    resultHandler:^void(UIImage *image, NSDictionary *info) {

                    }

but the result handler block always return nil image .why??

mythodeia commented 8 years ago

PHImageRequestOptionsDeliveryModeOpportunistic might call the completion handler more than once. In your case it returns nil every single time or does it show a degraded image first and then nil?

chrisze commented 8 years ago

Try self.requestOptions.synchronous = NO;

1and2papa commented 8 years ago

@qylibohao Please check the documentation of PHImageManger