Jaythaking
Jaythaking

Reputation: 2102

Missing quote when sharing a link to Messenger

I want to be able to send a link to Facebook Messenger along with a message. On their doc they say I need to assign a value to variable quote, but no success, the link is present but not the quote...

Here is their doc:

/**
  Some quote text of the link.

 If specified, the quote text will render with custom styling on top of the link.
 @return The quote text of a link
 */
@property (nonatomic, copy, nullable) NSString *quote;

I'm using their library: pod 'FBSDKShareKit', '6.5.2' on Swift so I import it in my bridging-header.

Here is the chunk of code where im using it:

   private func openFacebookMessenger(message: String, urlString: String) {
        guard let url = URL(string: urlString) else { return }
        let shareLinkContent = ShareLinkContent()
        shareLinkContent.contentURL = url
        shareLinkContent.quote = message
        
        let dialog = MessageDialog()
        dialog.shareContent = shareLinkContent
        dialog.shouldFailOnDataError = true
        if dialog.canShow {
            dialog.show()
        }
    }

and the result:

enter image description here

Upvotes: 4

Views: 707

Answers (2)

Nandish
Nandish

Reputation: 1177

The Facebook Document says that the Additional Features like Hashtags and Quote Sharing are supported when using Share dialog

https://developers.facebook.com/docs/sharing/ios

When you use the Facebook share dialog, you have additional options that aren't available when you share by using the API.

I see you are using MessageDialog, so that could be the reason it is not working. Try using ShareDialog instead if you want to use quote.

Upvotes: 1

Eldin SMAKIC
Eldin SMAKIC

Reputation: 39

My first guest is that the quote is shown when you have already share it, just bellow your answer not in the screen you have shown.

You can allow people to highlight text to appear as a quote with a shared link. You can also predefine a quote, such as a single quote in an article, to appear with the shared link. In both cases, the quote appears in its own field, separate from the user's comments.

https://developers.facebook.com/docs/sharing/ios

Upvotes: 0

Related Questions