Share Button for iOS
Updated: Jun 30, 2026
Copy for LLM
With the Share Button you will allow people to share content to their Facebook timeline, to a friend’s timeline or in a group.
The Share Button on mobile follows the same userflow like you know it from the Share Button for web: After tapping or clicking the button, the user will have options to add a message, customize the target audience and eventually confirm the share.
- Share Button: Will be displayed without share counter. User taps the Share Button, a new window will open (also known as fast-app-switch).
- Share Dialog: The window will show a post composer containing a preview of the shared link. If the user installed the Facebook app for iOS the share dialog will be served by the Facebook app otherwise by the Safari Browser. Via tap on the Share button the user will confirm the share and in the following come back to your application.

1. General iOS Setup
Complete the Getting Started Guide for Facebook iOS SDK before adding the Share button. The guide will include:
- Setting up a Facebook application.
- Downloading and installing the Facebook iOS SDK.
- Adding the Facebook iOS SDK to your project.
2. Add Frameworks
To use the Share button in your view you need to add the Frameworks
FBSDKCoreKit and FBSDKShareKit. You can find both in the Facebook iOS directory (~/Documents/FacebookSDK).- Drag & drop the frameworks to your
Frameworksfolder in Xcode’s project explorer. - Add the following
#importcalls to the header of your view controller:
// For example in ViewController.m after `#import "ViewController.h"`
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
3. Add Share Button Code
You can add the Share button to your view like you would any other UIView. Create a new Share button
FBSDKShareButton instance as shown in the code example shown below. Next assign an object of the type FBSDKShareLinkContent to the property shareContent. You must share a link URL (initWithContentURL), but all other values are optional.// ViewController.m
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL
URLWithString:@"https://www.facebook.com/FacebookDevelopers"];
FBSDKShareButton *shareButton = [[FBSDKShareButton alloc] init];
shareButton.shareContent = content;
shareButton.center = self.view.center;
[self.view addSubview:shareButton];
}
@end
Customizing Shared Content
Generally there are two options to customize your shared content:
- Using Open Graph Tags.
- Adjust
FBSDKShareLinkContentselectors
Below we show which properties you can use and which values they must have. Please keep in mind that the post composer result will depend on the user’s device configuration as well. E.g. the property
placeID is currently only available for users having the Facebook app for iOS installed on their device.| Selector | Description | Type |
|---|---|---|
initWithContentURL | URL for the content being shared. | NSURL |
peopleIDs | Array of IDs for people to tag ( NSString) | NSArray |
placeID | The ID for a place to tag with this content. | NSString |
ref | The ref for the content | NSString |
As of April 18, 2017, the following parameters are no longer supported by Graph API versions 2.9 and higher. For versions 2.8 and lower, the parameters will continue working until July 17, 2017.
| Selector | Description | Type |
|---|---|---|
contentTitle | The link title | NSString |
contentDescription | The description of the link | NSString |
imageURL | The network URL of an image | NSURL |
You can use the example posted below for testing the Share button in your application. User IDs used for
peopleIDs must be friends of the current user. You can use the Graph API Explorer to quickly obtain friends IDs. If you do not know about friends permissions please refer to the Facebook Login permissions guide.NSURL *contentURL = [[NSURL alloc] initWithString:
@"http://en.wikipedia.org/wiki/Facebook"];
button.shareContent = [[FBSDKShareLinkContent alloc]
initWithContentURL: contentURL
peopleIDs: @[@"1561082740838259"]
placeID: @"166793820034304"
ref: @"myRefId"
];
Display Example
For a person the result of the example code shown above will look somewhat like this:
