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.

  1. /*
  2.  * Constants used by NSNotificationCenter for active session notification
  3.  */
  4.  
  5.  
  6. /*! NSNotificationCenter name indicating that a new active session was set */
  7. externNSString *const FBSessionDidSetActiveSessionNotification;
  8.  
  9.  
  10. /*! NSNotificationCenter name indicating that an active session was unset */
  11. externNSString *const FBSessionDidUnsetActiveSessionNotification;
  12.  
  13.  
  14. /*! NSNotificationCenter name indicating that the active session is open */
  15. externNSString *const FBSessionDidBecomeOpenActiveSessionNotification;
  16.  
  17.  
  18. /*! NSNotificationCenter name indicating that there is no longer an open active session */
  19. externNSString *const FBSessionDidBecomeClosedActiveSessionNotification;
  20.  
  21. <--break->
  22. /*!
  23.  @typedef FBSessionState enum
  24.  
  25.  @abstract Passed to handler block each time a session state changes
  26.  
  27.  @discussion
  28.  */
  29. typedefenum {
  30.     /*! One of two initial states indicating that no valid cached token was found */
  31.     FBSessionStateCreated                   = 0,
  32.     /*! One of two initial session states indicating that a cached token was loaded;
  33.      when a session is in this state, a call to open* will result in an open session,
  34.      without UX or app-switching*/
  35.     FBSessionStateCreatedTokenLoaded        = 1,
  36.     /*! One of three pre-open session states indicating that an attempt to open the session
  37.      is underway*/
  38.     FBSessionStateCreatedOpening            = 2,
  39.    
  40.     /*! Open session state indicating user has logged in or a cached token is available */
  41.     FBSessionStateOpen                      = 1 | FB_SESSIONSTATEOPENBIT,
  42.     /*! Open session state indicating token has been extended */
  43.     FBSessionStateOpenTokenExtended         = 2 | FB_SESSIONSTATEOPENBIT,
  44.    
  45.     /*! Closed session state indicating that a login attempt failed */
  46.     FBSessionStateClosedLoginFailed         = 1 | FB_SESSIONSTATETERMINALBIT, // NSError obj w/more info
  47.     /*! Closed session state indicating that the session was closed, but the users token
  48.         remains cached on the device for later use */
  49.     FBSessionStateClosed                    = 2 | FB_SESSIONSTATETERMINALBIT, // "
  50. } FBSessionState;
  51.  
  52.  
  53. /*! helper macro to test for states that imply an open session */
  54. #define FB_ISSESSIONOPENWITHSTATE(state) (0 != (state & FB_SESSIONSTATEOPENBIT))
  55.  
  56.  
  57. /*! helper macro to test for states that are terminal */
  58. #define FB_ISSESSIONSTATETERMINAL(state) (0 != (state & FB_SESSIONSTATETERMINALBIT))
  59.  
  60.  
  61. /*!
  62.  @typedef FBSessionLoginBehavior enum
  63.  
  64.  @abstract
  65.  Passed to open to indicate whether Facebook Login should allow for fallback to be attempted.
  66.  
  67.  @discussion
  68.  Facebook Login authorizes the application to act on behalf of the user, using the user's
  69.  Facebook account. Usually a Facebook Login will rely on an account maintained outside of
  70.  the application, by the native Facebook application, the browser, or perhaps the device
  71.  itself. This avoids the need for a user to enter their username and password directly, and
  72.  provides the most secure and lowest friction way for a user to authorize the application to
  73.  interact with Facebook. If a Facebook Login is not possible, a fallback Facebook Login may be
  74.  attempted, where the user is prompted to enter their credentials in a web-view hosted directly
  75.  by the application.
  76.  
  77.  The `FBSessionLoginBehavior` enum specifies whether to allow fallback, disallow fallback, or
  78.  force fallback login behavior. Most applications will use the default, which attempts a normal
  79.  Facebook Login, and only falls back if needed. In rare cases, it may be preferable to disalow
  80.  fallback Facebook Login completely, or to force a fallback login.
  81.  */
  82. typedefenum {
  83.     /*! Attempt Facebook Login, ask user for credentials if necessary */
  84.     FBSessionLoginBehaviorWithFallbackToWebView      = 0,
  85.     /*! Attempt Facebook Login, no direct request for credentials will be made */
  86.     FBSessionLoginBehaviorWithNoFallbackToWebView    = 1,
  87.     /*! Only attempt WebView Login; ask user for credentials */
  88.     FBSessionLoginBehaviorForcingWebView             = 2,
  89.     /*! Attempt Facebook Login, prefering system account and falling back to fast app switch if necessary */
  90.     FBSessionLoginBehaviorUseSystemAccountIfPresent  = 3,
  91. } FBSessionLoginBehavior;
  92.  
  93.  
  94. /*!
  95.  @typedef FBSessionDefaultAudience enum
  96.  
  97.  @abstract
  98.  Passed to open to indicate which default audience to use for sessions that post data to Facebook.
  99.  
  100.  @discussion
  101.  Certain operations such as publishing a status or publishing a photo require an audience. When the user
  102.  grants an application permission to perform a publish operation, a default audience is selected as the
  103.  publication ceiling for the application. This enumerated value allows the application to select which
  104.  audience to ask the user to grant publish permission for.
  105.  */
  106. typedefenum {
  107.     /*! No audience needed; this value is useful for cases where data will only be read from Facebook */
  108.     FBSessionDefaultAudienceNone                = 0,
  109.     /*! Indicates that only the user is able to see posts made by the application */
  110.     FBSessionDefaultAudienceOnlyMe              = 10,
  111.     /*! Indicates that the user's friends are able to see posts made by the application */
  112.     FBSessionDefaultAudienceFriends             = 20,
  113.     /*! Indicates that all Facebook users are able to see posts made by the application */
  114.     FBSessionDefaultAudienceEveryone            = 30,
  115. } FBSessionDefaultAudience;
  116.  
  117.  
  118. /*!
  119.  @typedef FBSessionLoginType enum
  120.  
  121.  @abstract
  122.  Used as the type of the loginType property in order to specify what underlying technology was used to
  123.  login the user.
  124.  
  125.  @discussion
  126.  The FBSession object is an abstraction over five distinct mechanisms. This enum allows an application
  127.  to test for the mechanism used by a particular instance of FBSession. Usually the mechanism used for a
  128.  given login does not matter, however for certain capabilities, the type of login can impact the behavior
  129.  of other Facebook functionality.
  130.  */
  131. typedefenum {
  132.     /*! A login type has not yet been established */
  133.     FBSessionLoginTypeNone                      = 0,
  134.     /*! A system integrated account was used to log the user into the application */
  135.     FBSessionLoginTypeSystemAccount             = 1,
  136.     /*! The Facebook native application was used to log the user into the application */
  137.     FBSessionLoginTypeFacebookApplication       = 2,
  138.     /*! Safari was used to log the user into the application */
  139.     FBSessionLoginTypeFacebookViaSafari         = 3,
  140.     /*! A web view was used to log the user into the application */
  141.     FBSessionLoginTypeWebView                   = 4,
  142.     /*! A test user was used to create an open session */
  143.     FBSessionLoginTypeTestUser                  = 5,
  144. } FBSessionLoginType;