The following are the various Enumeration defined and used by the Facebook iOS SDK. Please review these for full understanding of how the SDK behaves for various operations.
- /*
- * Constants used by NSNotificationCenter for active session notification
- */
- /*! NSNotificationCenter name indicating that a new active session was set */
- externNSString *const FBSessionDidSetActiveSessionNotification;
- /*! NSNotificationCenter name indicating that an active session was unset */
- externNSString *const FBSessionDidUnsetActiveSessionNotification;
- /*! NSNotificationCenter name indicating that the active session is open */
- externNSString *const FBSessionDidBecomeOpenActiveSessionNotification;
- /*! NSNotificationCenter name indicating that there is no longer an open active session */
- externNSString *const FBSessionDidBecomeClosedActiveSessionNotification;
- <--break->
- /*!
- @typedef FBSessionState enum
- @abstract Passed to handler block each time a session state changes
- @discussion
- */
- typedefenum {
- /*! One of two initial states indicating that no valid cached token was found */
- FBSessionStateCreated =0,
- /*! One of two initial session states indicating that a cached token was loaded;
- when a session is in this state, a call to open* will result in an open session,
- without UX or app-switching*/
- FBSessionStateCreatedTokenLoaded =1,
- /*! One of three pre-open session states indicating that an attempt to open the session
- is underway*/
- FBSessionStateCreatedOpening =2,
- /*! Open session state indicating user has logged in or a cached token is available */
- FBSessionStateOpen =1 | FB_SESSIONSTATEOPENBIT,
- /*! Open session state indicating token has been extended */
- FBSessionStateOpenTokenExtended =2 | FB_SESSIONSTATEOPENBIT,
- /*! Closed session state indicating that a login attempt failed */
- FBSessionStateClosedLoginFailed =1 | FB_SESSIONSTATETERMINALBIT, // NSError obj w/more info
- /*! Closed session state indicating that the session was closed, but the users token
- remains cached on the device for later use */
- FBSessionStateClosed =2 | FB_SESSIONSTATETERMINALBIT, // "
- } FBSessionState;
- /*! helper macro to test for states that imply an open session */
- #define FB_ISSESSIONOPENWITHSTATE(state) (0 != (state & FB_SESSIONSTATEOPENBIT))
- /*! helper macro to test for states that are terminal */
- #define FB_ISSESSIONSTATETERMINAL(state) (0 != (state & FB_SESSIONSTATETERMINALBIT))
- /*!
- @typedef FBSessionLoginBehavior enum
- @abstract
- Passed to open to indicate whether Facebook Login should allow for fallback to be attempted.
- @discussion
- Facebook Login authorizes the application to act on behalf of the user, using the user's
- Facebook account. Usually a Facebook Login will rely on an account maintained outside of
- the application, by the native Facebook application, the browser, or perhaps the device
- itself. This avoids the need for a user to enter their username and password directly, and
- provides the most secure and lowest friction way for a user to authorize the application to
- interact with Facebook. If a Facebook Login is not possible, a fallback Facebook Login may be
- attempted, where the user is prompted to enter their credentials in a web-view hosted directly
- by the application.
- The `FBSessionLoginBehavior` enum specifies whether to allow fallback, disallow fallback, or
- force fallback login behavior. Most applications will use the default, which attempts a normal
- Facebook Login, and only falls back if needed. In rare cases, it may be preferable to disalow
- fallback Facebook Login completely, or to force a fallback login.
- */
- typedefenum {
- /*! Attempt Facebook Login, ask user for credentials if necessary */
- FBSessionLoginBehaviorWithFallbackToWebView =0,
- /*! Attempt Facebook Login, no direct request for credentials will be made */
- FBSessionLoginBehaviorWithNoFallbackToWebView =1,
- /*! Only attempt WebView Login; ask user for credentials */
- FBSessionLoginBehaviorForcingWebView =2,
- /*! Attempt Facebook Login, prefering system account and falling back to fast app switch if necessary */
- FBSessionLoginBehaviorUseSystemAccountIfPresent =3,
- } FBSessionLoginBehavior;
- /*!
- @typedef FBSessionDefaultAudience enum
- @abstract
- Passed to open to indicate which default audience to use for sessions that post data to Facebook.
- @discussion
- Certain operations such as publishing a status or publishing a photo require an audience. When the user
- grants an application permission to perform a publish operation, a default audience is selected as the
- publication ceiling for the application. This enumerated value allows the application to select which
- audience to ask the user to grant publish permission for.
- */
- typedefenum {
- /*! No audience needed; this value is useful for cases where data will only be read from Facebook */
- FBSessionDefaultAudienceNone =0,
- /*! Indicates that only the user is able to see posts made by the application */
- FBSessionDefaultAudienceOnlyMe =10,
- /*! Indicates that the user's friends are able to see posts made by the application */
- FBSessionDefaultAudienceFriends =20,
- /*! Indicates that all Facebook users are able to see posts made by the application */
- FBSessionDefaultAudienceEveryone =30,
- } FBSessionDefaultAudience;
- /*!
- @typedef FBSessionLoginType enum
- @abstract
- Used as the type of the loginType property in order to specify what underlying technology was used to
- login the user.
- @discussion
- The FBSession object is an abstraction over five distinct mechanisms. This enum allows an application
- to test for the mechanism used by a particular instance of FBSession. Usually the mechanism used for a
- given login does not matter, however for certain capabilities, the type of login can impact the behavior
- of other Facebook functionality.
- */
- typedefenum {
- /*! A login type has not yet been established */
- FBSessionLoginTypeNone =0,
- /*! A system integrated account was used to log the user into the application */
- FBSessionLoginTypeSystemAccount =1,
- /*! The Facebook native application was used to log the user into the application */
- FBSessionLoginTypeFacebookApplication =2,
- /*! Safari was used to log the user into the application */
- FBSessionLoginTypeFacebookViaSafari =3,
- /*! A web view was used to log the user into the application */
- FBSessionLoginTypeWebView =4,
- /*! A test user was used to create an open session */
- FBSessionLoginTypeTestUser =5,
- } FBSessionLoginType;