Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
  • Games
  • Payments
  • App Center
  • Promote Your App
  • iOS
    • Getting Started
    • Concepts
    • Reference
  • Android
  • JavaScript
  • PHP
  • More SDKs
  • Class References
    • FBCacheDescriptor
    • FBFriendPickerViewController
    • FBGraphObject
    • FBLoginView
    • FBPlacePickerViewController
    • FBProfilePictureView
    • FBRequest
    • FBRequestConnection
    • FBSession
    • FBSessionTokenCachingStrategy
    • FBTestSession
    • FBUserSettingsViewController
    • FBViewController
  • Protocol References
    • FBFriendPickerDelegate
    • FBGraphLocation
    • FBGraphObject
    • FBGraphPlace
    • FBGraphUser
    • FBLoginViewDelegate
    • FBOpenGraphAction
    • FBPlacePickerDelegate
    • FBUserSettingsDelegate
    • FBViewControllerDelegate
  • Other References
    • FBError
    • FBSettings

FBFriendPickerViewController

SDK Reference › iOS SDK › FBFriendPickerViewController
FBFriendPickerViewController
Inherits from: FBViewController
Declared in: FBFriendPickerViewController.h
Overview

The FBFriendPickerViewController class creates a controller object that manages the user interface for displaying and selecting Facebook friends.

Discussion

When the FBFriendPickerViewController view loads it creates a UITableView object where the friends will be displayed. You can access this view through the tableView property. The friend display can be sorted by first name or last name. Friends' names can be displayed with the first name first or the last name first.

The friend data can be pre-fetched and cached prior to using the view controller. The cache is setup using an FBCacheDescriptor object that can trigger the data fetch. Any friend data requests will first check the cache and use that data. If the friend picker is being displayed cached data will initially be shown before a fresh copy is retrieved.

The delegate property may be set to an object that conforms to the FBFriendPickerDelegate protocol. The delegate object will receive updates related to friend selection and data changes. The delegate can also be used to filter the friends to display in the picker.

Tasks
allowsMultipleSelection property
displayOrdering property
fieldsForRequest property
itemPicturesEnabled property
selection property
session property
sortOrdering property
spinner property
tableView property
userID property
+ cacheDescriptor
+ cacheDescriptorWithUserID:fieldsForRequest:
- clearSelection
- configureUsingCachedDescriptor:
- init
- initWithCoder:
- initWithNibName:bundle:
- loadData
- updateView
FBFriendDisplayOrdering enum typedef
FBFriendSortOrdering enum typedef
Properties
allowsMultipleSelection

A Boolean value that specifies whether multi-select is enabled.

@property (nonatomic) BOOL allowsMultipleSelection;
Declared In
FBFriendPickerViewController.h
displayOrdering

The order in which friends' names are displayed.

@property (nonatomic) FBFriendDisplayOrdering displayOrdering;
Declared In
FBFriendPickerViewController.h
fieldsForRequest

Addtional fields to fetch when making the Graph API call to get friend data.

@property (nonatomic, copy) NSSet *fieldsForRequest;
Declared In
FBFriendPickerViewController.h
itemPicturesEnabled

A Boolean value that indicates whether friend profile pictures are displayed.

@property (nonatomic) BOOL itemPicturesEnabled;
Declared In
FBFriendPickerViewController.h
selection

The list of friends that are currently selected in the veiw. The items in the array are FBGraphUser objects.

@property (nonatomic, retain, readonly) NSArray *selection;
Declared In
FBFriendPickerViewController.h
session

The session that is used in the request for friend data.

@property (nonatomic, retain) FBSession *session;
Declared In
FBFriendPickerViewController.h
sortOrdering

The order in which friends are sorted in the display.

@property (nonatomic) FBFriendSortOrdering sortOrdering;
Declared In
FBFriendPickerViewController.h
spinner

Returns an outlet for the spinner used in the view controller.

@property (nonatomic, retain) IBOutlet UIActivityIndicatorView *spinner;
Declared In
FBFriendPickerViewController.h
tableView

Returns an outlet for the table view managed by the view controller.

@property (nonatomic, retain) IBOutlet UITableView *tableView;
Declared In
FBFriendPickerViewController.h
userID

The profile ID of the user whose friends are being viewed.

@property (nonatomic, copy) NSString *userID;
Declared In
FBFriendPickerViewController.h
Class Methods
cacheDescriptor

Creates a cache descriptor based on default settings of the FBFriendPickerViewController object.

+ (FBCacheDescriptor*)cacheDescriptor;
Discussion

An FBCacheDescriptor object may be used to pre-fetch data before it is used by the view controller. It may also be used to configure the FBFriendPickerViewController object.

Declared In
FBFriendPickerViewController.h
cacheDescriptorWithUserID:fieldsForRequest:

Creates a cache descriptor with additional fields and a profile ID for use with the FBFriendPickerViewController object.

+ (FBCacheDescriptor*)cacheDescriptorWithUserID:(NSString*)userID fieldsForRequest:(NSSet*)fieldsForRequest;
Parameter
userID

The profile ID of the user whose friends will be displayed. A nil value implies a "me" alias.

fieldsForRequest

The set of additional fields to include in the request for friend data.

Discussion

An FBCacheDescriptor object may be used to pre-fetch data before it is used by the view controller. It may also be used to configure the FBFriendPickerViewController object.

Declared In
FBFriendPickerViewController.h
Instance Methods
clearSelection

Clears the current selection, so the picker is ready for a fresh use.

- (void)clearSelection;
Declared In
FBFriendPickerViewController.h
configureUsingCachedDescriptor:

Configures the properties used in the caching data queries.

- (void)configureUsingCachedDescriptor:(FBCacheDescriptor*)cacheDescriptor;
Parameter
cacheDescriptor

The containing the cache query properties.

Discussion

Cache descriptors are used to fetch and cache the data used by the view controller. If the view controller finds a cached copy of the data, it will first display the cached content then fetch a fresh copy from the server.

Declared In
FBFriendPickerViewController.h
init

Initializes a friend picker view controller.

- (id)init;
Declared In
FBFriendPickerViewController.h
initWithCoder:

Initializes a friend picker view controller.

- (id)initWithCoder:(NSCoder *)aDecoder;
Parameter
aDecoder

An unarchiver object.

Declared In
FBFriendPickerViewController.h
initWithNibName:bundle:

Used to initialize the object

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
Parameter
nibNameOrNil

The name of the nib file to associate with the view controller. The nib file name should not contain any leading path information. If you specify nil, the nibName property is set to nil.

nibBundleOrNil

The bundle in which to search for the nib file. This method looks for the nib file in the bundle's language-specific project directories first, followed by the Resources directory. If nil, this method looks for the nib file in the main bundle.

Declared In
FBFriendPickerViewController.h
loadData

Initiates a query to get friend data.

- (void)loadData;
Discussion

A cached copy will be returned if available. The cached view is temporary until a fresh copy is retrieved from the server. It is legal to call this more than once.

Declared In
FBFriendPickerViewController.h
updateView

Updates the view locally without fetching data from the server or from cache.

- (void)updateView;
Discussion

Use this if the filter or sort properties change. This may affect the order or display of friend information but should not need require new data.

Declared In
FBFriendPickerViewController.h
Typedefs
FBFriendDisplayOrdering enum

Indicates whether friends should be displayed first-name-first or last-name-first.

typedef enum {
FBFriendDisplayByFirstName,
FBFriendDisplayByLastName,
} FBFriendDisplayOrdering;
Discussion
Declared In
FBFriendPickerViewController.h
FBFriendSortOrdering enum

Indicates the order in which friends should be listed in the friend picker.

typedef enum {
FBFriendSortByFirstName,
FBFriendSortByLastName
} FBFriendSortOrdering;
Discussion
Declared In
FBFriendPickerViewController.h

Last Updated: November 19, 2012
Facebook © 2013 · English (US)
AboutAdvertisingCareersPlatform PoliciesPrivacy Policy