Handling Authentication Errors

SwiftObjective-C
UserAccountManagerSFUserAccountManager
UserAccountManagerDelegateSFUserAccountManagerDelegate

Mobile SDK provides default error handlers that display messages and divert the app flow when authentication errors occur. In an error event, the user account manager iterates through its delegates and gives them the chance to handle the error.

To insert your own classes into this chain, implement the delegate protocol and override the following method:

Swift:

Objective-C:

A return value of true or YES indicates that the method handled the current error condition. In this case, the user account manager takes no further action for this error. Otherwise, the delegate did not handle the error, and the error handling process falls to the next delegate in the list. If all delegates return false, the user account manager uses its own error handler.

For authentication error handling, Mobile SDK historically used a customizable list of SFAuthErrorHandler objects in the SFAuthenticationManager shared object. SFAuthenticationManager is now deprecated. If you had customized the authentication error handler list, update your code to use UserAccountManagerDelegate (Swift) or SFUserAccountManagerDelegate (Objective-C).