Share with the Message Dialog

To share with Facebook Messenger, use the Message Dialog. You can create a Messenger sharing dialog (MessageDialog) with any of the following sharing content types:

SUPPORTED SHARE TYPES

  • ShareLinkContent
  • ShareMessengerOpenGraphMusicTemplateContent
  • ShareMessengerMediaTemplateContent
  • ShareMessengerGenericTemplateContent

UNSUPPORTED SHARE TYPES (DEPRECATED as of AUGUST 2018)

  • ShareOpenGraphContent
  • SharePhotoContent
  • ShareVideoContent
  • Any other types that are not one of the four supported types listed above

Sharing with the MessageDialog object switches to the native Messenger for iOS app if able and, when complete, returns control to your app.

The following code example demonstrates how to share a link (ShareLinkContent) using the Messenger sharing dialog:

import FacebookShare

// Create a dialog for sharing to Messenger
let dialog = MessageDialog(
  content: myContent, 
  delegate: self
)

guard dialog.canShow else {
    print("Facebook Messenger must be installed in order to share to it")
    return
}

dialog.show()