Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS : How to convert a video PHAsset to NSData

I want to put the videos stored on my iPhone to my Google Drive. I have already done with images, but with videos, it's an other problem...

For images, no problem, I convert my asset to an NSData with this method :

   data = UIImagePNGRepresentation(result!)!

And I put the image to my drive !

But, for videos, I tried many different ways, but no, I can't.

How can I do ?

Thanks a lot !

like image 620
testa abalez Avatar asked Aug 14 '15 07:08

testa abalez


1 Answers

Please add Bellow solution its work for me

if you miss option.isNetworkAccessAllowed = true then you get error for genera the url

private let options: PHVideoRequestOptions = PHVideoRequestOptions()

option.isNetworkAccessAllowed = true 

PHImageManager.default().requestAVAsset(-------
like image 200
Raj Avatar answered Sep 20 '22 21:09

Raj