如何将gif文件分享到Facebook,Twitter,Instagram

时间:2017-06-12 15:40:44

标签: ios swift swift3

我创建了.gif文件并保存在本地路径中。在gmail上分享时,Gif播放得很好。但它在Facebook,Twitter和Instagram上分享时无法正常工作。它显示了第一个gif图像。以下是我的示例代码

let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0].appending("/animated.gif")
    pathURL = URL(fileURLWithPath: path)

    let imageData: NSData = NSData(contentsOf: pathURL!)!
    let objectsToShare: [AnyObject] = [imageData]    
    let vc = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)

    vc.popoverPresentationController?.barButtonItem = sender as? UIBarButtonItem
    self.present(vc, animated: true, completion: nil)

0 个答案:

没有答案