我是个iOS新手,想要使用Facebook SDK for iOS分享一个链接。我的代码如下:
我已经实现了
提前感谢。
@IBAction func shareVoucherUsingFacebook(sender: UIButton) {
print("Facebook")
let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: "www.google.com")
content.contentTitle = "Content Title"
content.contentDescription = "This is the description"
let shareDialog: FBSDKShareDialog = FBSDKShareDialog()
shareDialog.shareContent = content
shareDialog.delegate = self
shareDialog.fromViewController = self
shareDialog.show()
}
我已经实现了
FBSDKSharingDelegate
方法,但是当我按下这个按钮时无法接收到分享对话框,而是执行了func sharer(sharer: FBSDKSharing!, didFailWithError error: NSError!)
方法,这意味着出现了一些问题,但我无法弄清楚。提前感谢。