The FBSessionDelegate protocol defines the methods that a delegate of a Facebook object may implement. The methods are defined in Facebook.h.
The protocol declares methods that are implemented by your application to handle session callbacks during user authentication and permissions authorization. All the methods defined in this protocol are required.
You should implement the methods to handle one or more of the following scenarios:
User successfully logs in.
User successfully logs out.
User dismisses the authorization dialog during the login process.
An error occurs during the authorization process.
The access_token has been refreshed.
The current user session has expired during an API call.
Sent to the delegate when the user successfully logs in.
- (void)fbDidLogin;
Parameters
None
Notes
You will want to handle any post-login set up in your implementation. For example you could store the user's access_token in persistent storage.
Sent to the delegate when there is an error during authorization or if the user dismissed the dialog without logging in.
- (void)fbDidNotLogin:(BOOL)cancelled;
Parameters
cancelled - If the authorization failed due to user action.
Notes
You will want to handle the authorization dismissals and failures in your implementation.
Sent to the delegate when the user logged out.
- (void)fbDidLogout;
Parameters
None
Notes
You will want to handle any post-logout set up in your implementation. For example, you could remove the user's access_token from persistent storage if you previously stored this upon successful login.
Sent to the delegate when the access token is extended.
- (void)fbDidExtendToken:(NSString*)accessToken
expiresAt:(NSDate*)expiresAt;
Parameters
accessToken - The extended access_token.
expiresAt - The updated expiration date.
Notes
Implement this method to refresh any previously stored access_token in your app. For example, if you stored the session information in persistent storage you will need to update that information.
Sent to the delegate when Facebook Platform is invoked and the current user session has expired.
- (void)fbSessionInvalidated;
Parameters
None
Notes
You could implement this method and perhaps alert the user then invite them to re-authenticate your app.