Inherits from NSObject
Declared in FBSDKLoginManager.h

Overview

FBSDKLoginManager works directly with [FBSDKAccessToken currentAccessToken] and sets the “currentAccessToken” upon successful authorizations (or sets nil in case of logOut).

You should check [FBSDKAccessToken currentAccessToken] before calling logIn* to see if there is a cached token available (typically in your viewDidLoad).

If you are managing your own token instances outside of “currentAccessToken”, you will need to set “currentAccessToken” before calling logIn* to authorize further permissions on your tokens.

Properties

defaultAudience

the default audience.

@property (assign, nonatomic) FBSDKDefaultAudience defaultAudience

Discussion

you should set this if you intend to ask for publish permissions.

Declared In

FBSDKLoginManager.h

loginBehavior

the login behavior

@property (assign, nonatomic) FBSDKLoginBehavior loginBehavior

Declared In

FBSDKLoginManager.h

Class Methods

renewSystemCredentials:

Issues an asynchronous renewCredentialsForAccount call to the device’s Facebook account store.

+ (void)renewSystemCredentials:(void ( ^ ) ( ACAccountCredentialRenewResult result , NSError *error ))handler

Parameters

handler

The completion handler to call when the renewal is completed. This can be invoked on an arbitrary thread.

Discussion

This can be used to explicitly renew account credentials and is provided as a convenience wrapper around [ACAccountStore renewCredentialsForAccount:completion]. Note the method will not issue the renewal call if the the Facebook account has not been set on the device, or if access had not been granted to the account (though the handler wil receive an error).

If the [FBSDKAccessToken currentAccessToken] was from the account store, a succesful renewal will also set a new “currentAccessToken”.

Declared In

FBSDKLoginManager.h

Instance Methods

logInWithPublishPermissions:fromViewController:handler:

Logs the user in or authorizes additional permissions.

- (void)logInWithPublishPermissions:(NSArray *)permissions fromViewController:(UIViewController *)fromViewController handler:(FBSDKLoginManagerRequestTokenHandler)handler

Parameters

permissions

the optional array of permissions. Note this is converted to NSSet and is only an NSArray for the convenience of literal syntax.

fromViewController

the view controller to present from. If nil, the topmost view controller will be automatically determined as best as possible.

handler

the callback.

Discussion

Use this method when asking for publish permissions. You should only ask for permissions when they are needed and explain the value to the user. You can inspect the result.declinedPermissions to also provide more information to the user if they decline permissions.

This method will present UI the user. You typically should check if [FBSDKAccessToken currentAccessToken] already contains the permissions you need before asking to reduce unnecessary app switching. For example, you could make that check at viewDidLoad.

Declared In

FBSDKLoginManager.h

logInWithPublishPermissions:handler:

use logInWithPublishPermissions:fromViewController:handler: instead (Deprecated: use logInWithPublishPermissions:fromViewController:handler: instead)

- (void)logInWithPublishPermissions:(NSArray *)permissions handler:(FBSDKLoginManagerRequestTokenHandler)handler

Declared In

FBSDKLoginManager.h

logInWithReadPermissions:fromViewController:handler:

Logs the user in or authorizes additional permissions.

- (void)logInWithReadPermissions:(NSArray *)permissions fromViewController:(UIViewController *)fromViewController handler:(FBSDKLoginManagerRequestTokenHandler)handler

Parameters

permissions

the optional array of permissions. Note this is converted to NSSet and is only an NSArray for the convenience of literal syntax.

fromViewController

the view controller to present from. If nil, the topmost view controller will be automatically determined as best as possible.

handler

the callback.

Discussion

Use this method when asking for read permissions. You should only ask for permissions when they are needed and explain the value to the user. You can inspect the result.declinedPermissions to also provide more information to the user if they decline permissions.

This method will present UI the user. You typically should check if [FBSDKAccessToken currentAccessToken] already contains the permissions you need before asking to reduce unnecessary app switching. For example, you could make that check at viewDidLoad.

Declared In

FBSDKLoginManager.h

logInWithReadPermissions:handler:

use logInWithReadPermissions:fromViewController:handler: instead (Deprecated: use logInWithReadPermissions:fromViewController:handler: instead)

- (void)logInWithReadPermissions:(NSArray *)permissions handler:(FBSDKLoginManagerRequestTokenHandler)handler

Declared In

FBSDKLoginManager.h

logOut

Logs the user out

- (void)logOut

Discussion

This calls [FBSDKAccessToken setCurrentAccessToken:nil] and [FBSDKProfile setCurrentProfile:nil].

Declared In

FBSDKLoginManager.h