1 year ago

#284352

test-img

alionthego

How can I share text from iOS app to Facebook using FBSDKShareKit

I am able to share links, photos, videos, media with Facebook from my iOS app using the Facebook Share SDK.

However I can't figure out how to share text. What I find interesting is if you use the iOS ActivityViewController with a string in the activityItems argument it opens the same Facebook share sheet with the text there. However I can't figure out any workaround to get the text into the share sheet when you are directly using the Facebook SDK to share.

I am using the following to share photos which works fine in a SwiftUI app:

let photo = SharePhoto(
    image: image,
    isUserGenerated: true
)
var content = SharePhotoContent()
content.photos = [photo]

let dialog = ShareDialog(
    viewController: UIApplication.shared.keyWindow?.rootViewController,
    content: content,
    delegate: nil
)
dialog.show()

Is there anyway to share a string only using this approach?

ios

swift

xcode

facebook-ios-sdk

0 Answers

Your Answer

Accepted video resources