SFUserAccountManager Class

The SFUserAccountManager class provides methods to access authenticated accounts, add new accounts, log out accounts, and switch between accounts.

To access the singleton SFUserAccountManager instance, send the following message:

@property (nonatomic, strong) SFUserAccount *currentUserThe current user account.  If the user has never logged in, this property may be nil.
@property (nonatomic, readonly) NSString *currentUserIdA convenience property to retrieve the current user's ID. This property is an alias for currentUser.credentials.userId.
@property (nonatomic, readonly) NSString *currentCommunityIdA convenience property to retrieve the current user's community ID. This property is an alias for currentUser.communityId.
@property (nonatomic, readonly) NSArray *allUserAccountsAn NSArray of all the SFUserAccount instances for the app.
@property (nonatomic, readonly) NSArray *allUserIdsReturns an array that contains all user IDs.
@property (nonatomic, copy) NSString *activeUserIdThe most recently active user ID. If the user that’s specified by activeUserId is removed from the accounts list, this user may be temporarily different from the current user.
@property (nonatomic, strong) NSString *loginHostThe host to be used for login.
@property (nonatomic, assign) BOOL retryLoginAfterFailureA flag that controls whether the login process restarts after it fails. The default value is YES.
@property (nonatomic, copy) NSString *oauthCompletionUrlThe OAuth callback URL to use for the OAuth login process. Apps can customize this property. By default, the property’s value is copied from the SFDCOAuthRedirectUri property in the main bundle. The default value is @"testsfdc:///mobilesdk/detect/oauth/done".
@property (nonatomic, copy) NSSet *scopesThe OAuth scopes that are associated with the app.

Returns the path of the .plist file for the specified user account.

Adds a delegate to this user account manager.

Removes a delegate from this user account manager.

Sets the app-level login host to the value in app settings.

Loads all accounts.

Can be used to create an empty user account if you want to configure all of the account information yourself. Otherwise, use [SFAuthenticationManager loginWithCompletion:failure:] to automatically create an account when necessary.

Returns the user account that's associated with a given user ID.

Returns all accounts that have access to a particular organization.

Returns all accounts that match a particular instance URL.

Adds a user account.

Removes the user account that's associated with the given user ID.

Clears the account's state in memory (but doesn't change anything on the disk).

Applies the specified credentials to the current user. If no user exists, a user is created.

Applies custom data to the SFUserAccount that can be accessed outside that user's sandbox. This data persists between app launches. Because this data will be serialized, make sure that objects that are contained in customData follow the NSCoding protocol.

Use this method only for nonsensitive information.

Switches from the current user to a new user context.

Switches from the current user to the specified user account.

Informs the SFUserAccountManager object that something has changed for the current user.