FacebookShare SDK gives your app the ability to post content to Facebook on behalf of the user. You can share links with quoted text, photos from memory or the photo library, and videos — all through a single consistent ShareDialog interface.
What you can share
| Content type | Class | Description |
|---|---|---|
| Links | ShareLinkContent | A URL with optional quote text and a hashtag |
| Photos | SharePhotoContent | Up to 10 photos from UIImage, a file URL, or a PHAsset |
| Videos | ShareVideoContent | A single video from a file URL, raw Data, or a PHAsset |
| Mixed media | ShareMediaContent | A combination of photos and at most one video |
Share modes
ShareDialog supports several presentation modes, controlled by the mode property:
- Automatic (default) — the dialog selects the best available mode at runtime, preferring the native Facebook app when installed.
- Native — opens the share sheet inside the Facebook app. Requires the Facebook app to be installed.
- Share sheet — uses the iOS integrated share sheet (
SLComposeViewController). Requires the Facebook app. - Browser — opens the share dialog in Safari.
.automatic and let the SDK choose.
Required SDK
AddFacebookShare to your project. If you use Swift Package Manager, add the FacebookShare product from the Facebook iOS SDK package. For CocoaPods, add the FBSDKShareKit pod to your Podfile.
FacebookShare depends on FacebookCore. Both are included when you add FacebookShare through either package manager.Pages in this section
Share dialog
Present a share dialog, choose a mode, and handle the delegate callbacks.
Share link content
Build link payloads with quotes and hashtags.
Photos and videos
Share images, videos, and mixed media.