UIActivityViewController-Facebook分享缓存视频缩略图

时间:2018-07-12 23:59:07

标签: swift uiactivityviewcontroller

我正在使用Apple标准的UIActivityViewController在社交网络上共享视频。视频网址本身不会更改,因为我只是删除了该位置上的先前资产,并用新资产进行了更新。除Facebook似乎会缓存第一个视频的缩略图,然后将其用于该会话中的所有视频外,此功能对其他所有功能都很好。但是,如果您实际上点击了Facebook共享中的视频,则会播放正确的视频。因此,问题完全出在缩略图上。是否可以清除或阻止此视频缩略图缓存?

func presentShare()
    {
        self.mediaAssetURL = self.videoItem.newzDetailVideoItemView.mediaController.getAssetURL()
        self.shareAssetURL = self.videoItem.newzDetailVideoItemView.mediaController.getShareURL()

        let activityVC = UIActivityViewController(activityItems: [self, self.mediaAssetURL!.absoluteString], applicationActivities: nil)
        activityVC.excludedActivityTypes = [UIActivityType.airDrop, UIActivityType.assignToContact, UIActivityType.copyToPasteboard, UIActivityType.openInIBooks, UIActivityType.print]

        self.present(activityVC, animated: true, completion: nil)
    }

    // MARK: - Activity Delegates

    func activityViewControllerPlaceholderItem(_ activityViewController: UIActivityViewController) -> Any
    {
        return ""
    }

    func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivityType?) -> Any?
    {
        if activityType == UIActivityType.postToTwitter
        {
            let thumbImageView = UIImageView()
            thumbImageView.sd_setImage(with: URL(string: model.thumbURL!))
            return thumbImageView.image
        }

        return self.shareAssetURL
    }

    func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivityType?) -> String
    {
        return "Subject"
    }

0 个答案:

没有答案