gpt4 book ai didi

ios - Swift:使用 ActivityViewController 共享视频仅适用于 iMessage,不适用于任何其他

转载 作者:行者123 更新时间:2023-11-30 12:46:35 33 4
gpt4 key购买 nike

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 共享视频,但它仅适用于 iMessage,不适用于任何其他社交网络或邮件。请帮助我

最佳答案

社交网络不支持使用默认共享表共享视频。您需要使用自定义方法分别为所有网络共享视频。

关于ios - Swift:使用 ActivityViewController 共享视频仅适用于 iMessage,不适用于任何其他,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41561413/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com