Facebook Share Sample for iOS Apps

The Facebook Share Sample included with the Facebook SDK for iOS has the source code and project files that you can build and run to demonstrate sharing a photo or a link to Facebook from an app.

This sample will only works on an iOS device and not in the Xcode simulator. Run this sample in a device.

Before You Start

You will need an App ID to run this sample. Learn more at App Development

Step 1: Open the Sample in Xcode

In this step, you will download the SDK, open the sample project in Xcode, and update the package to the latest package version.

  1. Clone or download the Facebook SDK for iOS at https://github.com/facebook/facebook-ios-sdk.

  2. In Xcode, open /samples/FacebookShareSample/FacebookShareSample.xcodeproj.

  3. In Xcode, click File > Swift Packages > Update to Latest Package Version.

Step 2: Configure Your Project

In this step, you will add your App ID to the information property list file (info.plist)

  1. Right-click Info.plist, and choose Open As > Source Code.

  2. Under <key>CFBundleURLSchemes</key> in the <array> <string>, replace {your-app-id} with your App ID. Under <key><FacebookAppID> </key> <string>, replace {your-app-id} with your App ID.

Step 3: Run the Sample

Run the sample on a device according to the steps in Running Your App in the Simulator or on a Device at developer.apple.com