I have an app that creates a unique photo gallery for each ticket on my app. I need to figure out how to loop through that gallery so I can upload the images to the server o
func fetchVideoFromLibrary() {
let fetchOptions: PHFetchOptions = PHFetchOptions()
fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]
let fetchResult = PHAsset.fetchAssetsWithMediaType(.Video, options: fetchOptions)
fetchResult.enumerateObjectsUsingBlock { (object, index, stop) -> Void in
let options = PHImageRequestOptions()
options.synchronous = true
options.deliveryMode = .HighQualityFormat
PHImageManager.defaultManager().requestAVAssetForVideo(object as! PHAsset, options: .None) { (avAsset, avAudioMix, dict) -> Void in
print(avAsset)
}
}
}