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)
To use the Facebook Sharing SDK in your project, make it a dependency in Maven. Build your project. Get your Facebook App ID properly configured and linked to your Android app. If you don't have a Facebook App ID for your app yet, see Facebook SDK Quick Start for Android.
Versions 4.0+ of the Facebook SDKs have new models for sharing content. Each type of content people want to share has a class you can use to represent it. After you model the content, add a sharing interface to your app. When people share links from your app to Facebook, it includes a contentURL with the link to be shared.
People can also share content from your app to Facebook Messenger. Before you can share to Facebook from your app, you to link or download the Facebook Sharing SDK for Android. The Sharing SDK for Android is a component of the Facebook SDK for Android.
The Sharing SDK for Android is a component of the Facebook SDK for Android. When you use the Facebook SDK, some events in your app are automatically logged and collected unless you disable automatic event logging. For details about what information is collected and how to disable automatic event logging, see Automatic App Event Logging.
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()
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