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

标签 ios swift

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/

相关文章:

ios - 如何用两个 "tabs"更好地实现 UITableView ?

ios - 使用 UIDiffableDataSource TableView 删除项目时,不会调用 NFetchedResultsController 委托(delegate)方法 didChangeContentWith

ios - SWIFT:尝试使用 objective c 类的委托(delegate)方法

android - 如何在基于Xamarin.forms的webview中使用html5视频标签?

ios - didReceiveRemoteNotification 和 didFinishLaunchingWithOptions 的果酱 Hook

ios - 如何以编程方式将 UIImageView 添加到 UIStackView ( Storyboard)

ios - UITableView 的交互部分标题

ios - 在 swift ios 中从 JSON 响应访问值

iOS 过滤成人内容的图像

iphone - Objective-C 日志方法调用