var selectedVideoArray: Array<Any> = []
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)
{
if (shareEnabled) {
let selectedVideo = fetchResult[indexPath.row]
self.selectedVideos.add(selectedVideo)
var videoPhAsset: PHAsset!
videoPhAsset = fetchResult.object(at: indexPath.row)
PHImageManager.default().requestAVAsset(forVideo: videoPhAsset, options: nil, resultHandler: { (AVAsset, AVAudio, info) in
var assetVideoUrl: NSURL
var avUrlAsset: AVURLAsset
avUrlAsset = AVAsset as! AVURLAsset
assetVideoUrl = (avUrlAsset.url as? NSURL)!
self.selectedVideoArray.append(assetVideoUrl.filePathURL!)
})
}
}
@IBAction func shareVideos(_ sender: Any) {
let moreAction = UIAlertAction(title: "More", style: UIAlertActionStyle.default) { (action) -> Void in
let activityViewController = UIActivityViewController(activityItems: self.selectedVideoArray, applicationActivities:nil)
activityViewController.popoverPresentationController?.sourceView = self.view // so that iPads won't crash
self.present(activityViewController, animated: true, completion: nil)
}
let dismissAction = UIAlertAction(title: "Close", style: UIAlertActionStyle.cancel) { (action) -> Void in
}
actionSheet.addAction(moreAction)
actionSheet.addAction(dismissAction)
present(actionSheet, animated: true, completion: nil)
}
我正在尝试使用社交框架和ActivityViewController分享视频,但它仅适用于iMessages,不适用于任何其他社交网络或邮件。请帮帮我
答案 0 :(得分:0)
社交网络不支持使用默认共享表进行视频共享。您需要为所有网络分别使用自定义方法分享视频..