我正在制作一个样例facebook分享应用程序,使用分享按钮分享一些字符串值,但我感到困惑,因为社交在ios 11中是分散的
我现在应该使用什么代码,我已经为swift安装了facebook sdk
我想要siwft语言的代码,我已经在谷歌上搜索过了,我发现没有代码,这对我的情况很有用
下面是我在onclikbutton操作下使用的代码
@IBAction func shareButton(_ sender: Any) {
let alert = UIAlertController(title: "Share", message: "Poem Of the day", preferredStyle: .actionSheet)
let actionOne = UIAlertAction(title: "Share on Facebook", style: .default) { (action) in
print("Success")
}
alert.addAction(actionOne)
self.present(alert, animated: true, completion: nil)
}编辑:-使用以下代码找到在facebook上分享帖子的更好方法
@IBAction func shareButton(_ sender: Any) {
let content = FBSDKShareLinkContent()
content.contentURL = URL(string: "https://github.com/EndLess728")
let dialog : FBSDKShareDialog = FBSDKShareDialog()
dialog.fromViewController = self
dialog.shareContent = content
dialog.mode = FBSDKShareDialogMode.feedWeb
dialog.show()
}发布于 2018-09-25 16:16:20
使用UIActivityViewController共享content…
@IBAction func share(_ sender: Any) {
let sharingItems: [Any] = [URL(string: "https://github.com/EndLess728")]
let activityController = UIActivityViewController(activityItems: sharingItems, applicationActivities: nil)
present(activityController, animated: true)
}https://stackoverflow.com/questions/52491654
复制相似问题