From Facebook Developer Documentation, I see that I can share image, animated image, even audio clips from other app to Facebook Messenger. But I can see no way to share a link. Neither does when I try to look what kind of share does the FBSDKMessengerShare offer.
How can I share a link using Facebook Messenger?
Click the 3 dots icon on the right side of the MyLink card, then click the Share button. 2. When you select the app you want to share, you can share the My Link directly.
Access the page and click on the three dots at the bottom right of the screen for the Page Settings. How to copy your messaging link in the Facebook Pages app. When you click the Share Link to Message Page, it will give you the option to share it or copy it.
Messenger appInside Messenger, tap on your profile picture in the top left. Scroll down to Photos & Media and enter that sub-menu. The toggle for "Open Links in Default Browser" should be set to on. And there you go — Android users get the quick and easy solution to this issue.
Manually enter -- or copy and paste -- the link into the "Message" field of a new message or the blank field at the bottom of an existing conversation. Hit the "Enter" key. Facebook will search for a short description and thumbnail image to attach to the link.
Seems that it can't be done with FBSDKMessengerShare, but with FBSDKShareKit it's possible. (I'm using Xcode 8.3, Swift 3.1, Cocoapods with FacebookShare 0.2.0)
More info available at https://developers.facebook.com/docs/sharing/ios
There are two methods:
Using FBSDKMessageDialog: "The Message Dialog switches to the native Messenger for iOS app, then returns control to your app after a post is published."
@IBAction func messengerButtonAction(_ sender: UIButton) {
let linkContent = FBSDKShareLinkContent()
linkContent.contentURL = URL(string: "https://itunes.apple.com/in/app/someValidAppURL...")
let dialog = FBSDKMessageDialog()
dialog.shareContent = linkContent
dialog.shouldFailOnDataError = true
if dialog.canShow() {
dialog.show()
}
}
Using FBSDKSendButton: "The Send button lets people privately send photos, videos and links to their friends and contacts using the Facebook Messenger. The Send button will call a Message dialog."
This creates a share button that is displayed in a specified view. The button will be automatically disabled if the Messenger app is not installed on the device.
override func viewDidLoad() {
let linkContent = FBSDKShareLinkContent()
linkContent.contentURL = URL(string: "https://itunes.apple.com/in/app/someValidAppURL...")
let button = FBSDKSendButton()
button.shareContent = linkContent
if button.isEnabled {
self.view.addSubview(button)
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With