I am a newbie in iOS, and I would like to share a link using the Facebook SDK for iOS. My code's as follows:
@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() }
I have also implemented the FBSDKSharingDelegate
methods, but I am not able to receive the share dialog when I press this button, and the method func sharer(sharer: FBSDKSharing!, didFailWithError error: NSError!)
is being executed, which means something is going wrong, but I can't figure it out.
Thanks in advance.