lundi 29 juin 2015

requestImageDataForAsset returns nil image data

I've been stuck with this for couple of days. I've bee trying to get the image within the call back but I always get nil. These the options which I used:

 let options = PHImageRequestOptions()
            options.deliveryMode = .HighQualityFormat
            options.resizeMode = .None

I also tried with options set to nil without any luck. This is the data I got in the info value passed to the block.

[PHImageResultIsInCloudKey: 0, 
 PHImageResultDeliveredImageFormatKey: 9999, 
 PHImageFileURLKey: file:///var/mobile/Media/DCIM/100APPLE/IMG_0052.JPG, 
 PHImageResultRequestIDKey: 84, 
 PHImageResultIsDegradedKey: 0, 
 PHImageResultWantedImageFormatKey: 9999,  
 PHImageResultIsPlaceholderKey: 0, 
 PHImageFileSandboxExtensionTokenKey: 
  64b47b046511a340c57aa1e3e6e07994c1a13853;00000000;00000000;0000001a;com.apple.app-sandbox.read;;00000000;00000000;0000000000000000;/private/var/mobile/Media/DCIM/100APPLE/IMG_0051.JPG]

I also tried using requestImageForAsset and I got the same result. I thought by using requestImageDataForAsset I'll get more control on the data.

Also, I thought the file exists in the cloud, but it is not as PHImageResultIsInCloudKey value is set 0; otherwise, I'd download it.

by the way, I am able to get a smaller version of the image with predefined size of 200x200 inside another view; however, when I try to get the larger version of it, I get nil. I know that the image exists on the phone with higher res (I can see it in the Photos app)

Any help will be appreciated.

Aucun commentaire:

Enregistrer un commentaire