我的应用程序中有一个按钮,当它点击它调用此功能来共享一个UIImage到Facebook,但它不起作用。我按照facebook的文档,我不知道为什么它不起作用。 这是我的代码
func shareImage(image: UIImage) {
let photo = Photo(image: image!, userGenerated: true)
let content = PhotoShareContent(photos: [photo])
try! ShareDialog.show(from: self, content: content)
}
你能帮我吗?
谢谢。
答案 0 :(得分:0)
我与Facebook共享内容link成功了。
let vc = SLComposeViewController(forServiceType:SLServiceTypeFacebook)
vc.add(image)
vc.add(URL(string: "http://www.example.com/")) // optional
vc.setInitialText("Initial text here.")
self.present(vc, animated: true, completion: nil)