Sample Apps for the Facebook SDK for iOS

This page features a list of all the current sample applications for the Facebook SDK for iOS:

Samples bundled with the SDK

The SDK comes with samples that demonstrate some of its features. To find and run these samples, download the SDK, and then click on the .pkg file and follow the wizard to install it. Once the SDK is installed, go to the FacebookSDK folder (located by default inside your Documents folder), and there you will find a Samples folder that contains the samples you're looking for. You can run them from Xcode in the iPhone simulator.


FriendPickerSample

Demonstrates how to use a FBFriendPickerViewController in the Facebook SDK for iOS.


GraphApiSample

Demonstrates the basics of how to make a (single or batch) request using the Facebook SDK for iOS.


HelloFacebookSample

Demonstrates some basic usage of the Facebook SDK, including:

  • Login with Facebook, using the FBLoginView.
  • Display a user's profile picture, using the FBProfilePictureView.
  • Post a status update and a photo, using FBRequest.
  • Display the user's friends and let them select a set of friends, using FBFriendPickerViewController.
  • Display a list of nearby places and let the user select one, using FBPlacePickerViewController.

PlacePickerSample

Demonstrates how to use the FBPlacePickerViewController provided with the Facebook SDK for iOS.


ProfilePictureSample

Demonstrates how to use the Profile picture control provided with the Facebook SDK for iOS.


RPSSample

Demonstrates how to create and query Open Graph Actions. The app consists of two views. The first view allows the user to post Open Graph Actions to their Timeline. The second view allows the user to see a list of their friends who have also installed the Rock, Paper, Scissors sample app, select one of those friends, and retrieve a list of the actions that that friend has recently posted.

This app can serve as the basis for integrating Facebook into a real-world app that has multiple types of Open Graph actions and that allows a user to view their friends' recent app-related activity directly from within the app.


Scrumptious

Scrumptious demonstrates a "real-world" (albeit very limited) application that integrates with Facebook. It allows a user to select from a small pre-defined list a dish that they are eating, then tag friends who they are with, and tag the restaurant they are in. Scrumptious then allows them to post a story about eating that dish to their Timeline which will display the the tagged friends and location. This is done using Open Graph.

The sample also utilizes and demonstrate several other SDK features, including:

  • Login with Facebook, using FBLoginView.
  • Selecting Facebook friends from a list, using FBFriendPickerViewController.
  • Picking a location, using FBPlacePickerViewController.
  • Log the user out, using FBuserSettingsViewController.

SessionLoginSample

Demonstrates how to use the FBSession object to login to Facebook and manage access tokens.


SwitchUserSample

Demonstrates an approach to allow switching between multiple users who log in with Facebook on, for example, a shared family iPad.

In this sample, we have the concept of a "Primary User" and up to three "Guest Users". The Primary User authenticates using SSO, if possible, while the Guest Users are asked to login using their Facebook credentials. Once authenticated, no further requests are made for user passwords, etc. so a solution such as this would be applicable only in a scenario that implies a high degree of trust amongst the various users.

Samples with tutorials

Some of our tutorials are accompanied with fully-functioning sample applications that demonstrate an SDK feature. You can download these samples from GitHub. Below there's a list of these samples, with a brief description of the features they demonstrate, a link to where they are hosted on GitHub, and a link to the tutorial they belong to. To run each of these samples, you will need to follow the instructions in each particular tutorial.


FBGraphAPISample

This sample makes example calls to the Graph API to request the user's information, request an object, post an object to the graph, stage an image using Facebook's image staging service, and delete an object.

Find FBGraphAPISample on GitHub.

Read the Graph API tutorial that follows this sample.


FBLoginCustomUISample

This sample implements Facebook Login using Graph API calls and a custom button.

Find FBLoginCustomUISample on GitHub.

You can read the tutorial for this sample here.


FBLoginUIControlSample

This sample shows a simple login with Facebook using the standard Facebook Login button.

Find FBLoginUIControlSample on GitHub.

You can find the tutorial for this sample here.


FBOGSample

This sample publishes an Open Graph story using Graph API calls. This app also implements Facebook Login and asks for the necessary permissions to post to Facebook on the user's behalf.

Find FBOGSample on GitHub.

Find the tutorial that follows this sample's code here.


FBOGSampleSD

This sample publishes an Open Graph story using the Share Dialog.

Find FBOGSampleSD on GitHub.

Find the tutorial here.


FBShareSample

This sample shows how to publish a link and a status updates using both methods: the Share Dialog and Graph API calls.

Find FBShareSample on GitHub.

Find the tutorial here.

Was this document helpful?