6

Prior to using Facebook SDK we used to share via UIActivityViewController since Facebook does not allow for us to pre-fill information on the user sharing, our solution was to use information the user description of the Image being share UIPasteboard.general.string. So the app would switch to the messenger and the user could paste. This worked just fine until we started using the Facebook SDK.

Now it seems that the UIPasteboard.general.string is reset when it opens up messenger and we no longer can get the image description copied to the clipboard.

This is how I'm sharing to messenger:

let sharePhoto = FBSDKSharePhoto()
sharePhoto.image = image

let content = FBSDKSharePhotoContent()
content.photos = [sharePhoto]

FBSDKMessageDialog.show(with: content, delegate: delegate)
Diogo Antunes
  • 2,241
  • 1
  • 22
  • 37
  • So you put this into the clipboard for the user already? That is not even allowed, see https://developers.facebook.com/docs/apps/review/prefill _“Your app can suggest content, but the person using your app should choose to manually copy and paste or type that content themselves.”_ – CBroe Mar 22 '18 at 09:07
  • Yes I put it on the user clipboard but informing the user first, if they wanna copy it to the clipboard or not. But even if the user copies something from a UITextView, it just gets erased when the Facebook SDK opens up messenger. – Diogo Antunes Mar 22 '18 at 09:42
  • Sounds like something Facebook might have implemented deliberately. – CBroe Mar 22 '18 at 10:06
  • Check this, it is going to change it's api - https://developers.facebook.com/docs/sharing/ios – Jayachandra A Mar 27 '18 at 06:27

2 Answers2

3

Yes, I'm stacked on that staff too after FB lib update. As for me - I figured out with web link on image like it shown below. As a result - you do not need ask user to paste something. You can do it by yourself and paste it to title or description.

let content = LinkShareContent(url: url,
                                       title: title,
                                       description: description,
                                       quote: nil,
                                       imageURL: imageURL)

        let dialog = ShareDialog(content: content)
        dialog.presentingViewController = parentVC
        dialog.mode = .automatic
        dialog.completion = { result in
             ...
        }

        try? dialog.show()
Pavel Kandziuba
  • 141
  • 1
  • 8
  • title and descriptions are read-only properties now. So, we can't provide text for title or description properties – Srinivas G Oct 02 '18 at 07:10
0

Facebook is not support UI share both image and text. If you want to share an image and a text together, you can create a custom story from your app's settings, and share it as an open graph story. Here's the documentation.

  • It seems OpenGraph settings not available for facebook app in developer account. So, how do we configure open graph settings to avail those features? – Srinivas G Nov 07 '18 at 07:37