Getting Started

The Facebook SDK for Swift is distributed via CocoaPods and Carthage. While you may compile and use the SDK outside of these systems, we strongly recommend that you choose one of them.

Prerequisite: Configure Facebook App Settings for iOS

  1. Open the Facebook App Dashboard by clicking on the button below and selecting your application. You may need to create a new application and then select it.

  2. Open Facebook App Dashboard

  3. Select Settings and then Basic from the left navigation pane.
  4. Click Add Platform at the bottom of the page and select iOS.
  5. Locate your bundle identifier in Xcode and copy it to your clipboard.
  6. Return to the App Dashboard and paste your bundle identifier into the Bundle ID field.
  7. Enable Single Sign On.
  8. Click Save Changes at the bottom of the App Dashboard window.


To use the SDK with CocoaPods, add the following lines to your Podfile:


pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'

Each of these dependencies can be used independently. Exclude any that you don't need.


To use the SDK with Carthage, add the following line to your Cartfile:

github "facebook/facebook-sdk-swift"

After performing a carthage install, add FacebookCore.framework, FacebookLogin.framework, and FacebookShare.framework to your project, along with their Facebook SDK for iOS dependencies (FBSDKCoreKit.framework, FBSDKLoginKit.framework, FBSDKShareKit.framework).

Configure Info.plist

  1. In Xcode, right-click your project's Info.plist file and select Open As -> Source Code.
  2. Insert the following XML snippet into the body of your file just before the final </dict> element.

  3. <key>CFBundleURLTypes</key>
  4. Replace {your-app-id}, and {your-app-name} with your app's App's ID and name found on the Facebook App Dashboard.

Connect Your App Delegate

Add the following to your AppDelegate class. This initializes the SDK when your app launches, and lets the SDK handle results from the native Facebook app when you perform a Login or Share action.

import FacebookCore

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
  SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
  return true

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
  return SDKApplicationDelegate.shared.application(app, open: url, options: options)

Manually Compiling

While not recommended, it is entirely possible for you to build the Facebook SDK for Swift outside of any dependency management system. Note that you will need to manage the process of updating this solution, as well as the dependencies it has on the Facebook SDK for iOS.

To compile the SDK manually:

  1. Start by cloning the repository:

    git clone
  2. Initialize all submodules:

    cd facebook-swift-sdk
    git submodule update --init --recursive
  3. Add the FacebookSwift.xcodeproj as a sub-project to your application's project.
  4. If it is missing, copy the file Bolts.xcodeproj to your application's project.
  5. Add the FacebookCore.framework, FacebookLogin.framework, and FacebookShare.framework build products from that subproject to your application's Link Frameworks and Libraries section, as well as your Embedded Binaries section.
  6. Embed/link Bolts.framework, FBSDKCoreKit.framework, FBSDKLoginKit.framework, and FBSDKShareKit.framework.