我可以使用以下代码将我的iOS应用程序内容分享到Facebook:
@IBAction func fbAction(_ sender: AnyObject) {
if SLComposeViewController.isAvailable(forServiceType: SLServiceTypeFacebook) {
let fbShare:SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
let url = URL(string: picturebookstring)
let data = try? Data(contentsOf: url!)
fbShare.setInitialText(titlebookstring + " book is available now on our application")
fbShare.add(UIImage(data: data!))
fbShare.add(URL(string: "http://bookmooch.com/"))
self.present(fbShare, animated: true, completion: nil)
} else {
let alert = UIAlertController(title: "Accounts", message: "Please login to your Facebook account ", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}
点击一个简单的按钮后我就这么做了,现在我想用Facebook分享按钮更改这个按钮。
我可以在不通过Facebook iOS SDK的情况下获得此按钮吗? https://developers.facebook.com/docs/ios