Reputation: 1225
Its simple, How can i get an absolute path for a video retrieved using ALAssets Library? I want to upload this video as file attachment using ASI framework.
It works if i use UIImagePickerViewController. But thats NOT an option any more. I also dont want to use NSData or copy-pasting video to temp file. Need a smart solution? Anybody ?
Upvotes: 1
Views: 1376
Reputation: 5782
You can use ALAssetPropertyAssetURL
. From documentation:
The key to retrieve a URL identifier for the asset.
The corresponding value is an NSURL object.
This URL is used by the library-change notifications to identify assets and asset groups. Only the ALAssetRepresentation and ALAssetsGroup classes support this property.
So, once you get ALAsset
object you can get url like this:
asset.defaultRepresentation.url
Upvotes: 0
Reputation: 6303
You can't get the absolute path (file system path) for a video you retrieved using the AssetsLibrary-Framework. The simple reason for that is that these files are outside your app's sandbox and you can't access them directly. You need to use the getBytes-Method of ALAssetsRepresentation to get the byte data of the video file. Most likely you will have to save this data to a temp file, before you can attach it to an email.
Cheers,
Hendrik
Upvotes: 1