SFUserAccount Class Reference
| Inherits from | NSObject |
|---|---|
| Conforms to | NSSecureCoding |
| Declared in | SFUserAccount.h |
Overview
Class that represents an account. An account represents
a user together with the current community it is logged in.
Other Methods
accessScopes
The access scopes for this user
@property (nonatomic, copy, nullable) NSSet<NSString*> *accessScopesDeclared In
SFUserAccount.h
accountIdentity
The unique identifier for this account.
@property (nonatomic, readonly) SFUserAccountIdentity *accountIdentityDeclared In
SFUserAccount.h
credentials
The credentials associated with this user
@property (nonatomic, strong) SFOAuthCredentials *credentialsDeclared In
SFUserAccount.h
notificationTypes
The notification types for this user
@property (nonatomic, strong, nullable) NSArray<NotificationType*> *notificationTypesDeclared In
SFUserAccount.h
idData
The identity data associated with this user
@property (nonatomic, strong) SFIdentityData *idDataDeclared In
SFUserAccount.h
photo
The user’s photo. Usually store a thumbnail of the user.
To set this property use setPhoto:completion:
@property (nonatomic, strong, nullable, readonly) UIImage *photoDeclared In
SFUserAccount.h
accessRestrictions
The access restriction associated with this user
@property (nonatomic) SFUserAccountAccessRestriction accessRestrictionsDeclared In
SFUserAccount.h
sessionValid
Returns YES if the user has an access token and, presumably, a valid session.
@property (nonatomic, readonly, getter=isSessionValid) BOOL sessionValidDeclared In
SFUserAccount.h
userDeleted
Indicates if this account was deleted. Returns YES if this account was deleted since being created.
@property (nonatomic, readonly, getter=isUserDeleted) BOOL userDeletedDeclared In
SFUserAccount.h
loginState
Indicates this user’s current login state.
@property (nonatomic, readonly, assign) SFUserAccountLoginState loginStateDeclared In
SFUserAccount.h
– initWithCredentials:
Initialize with SFOAuthCredentials credentials
- (instancetype)initWithCredentials:(SFOAuthCredentials *)credentialsParameters
credentials |
The credentials to link with the SFUserAccount. |
|---|
Return Value
the account instance
Declared In
SFUserAccount.h
– setCustomDataObject:forKey:
Set object in customData dictionary
- (void)setCustomDataObject:(id<NSCoding>)object forKey:(id<NSCopying>)keyParameters
object |
The object to store, must be one of the following: NSString, NSNumber, NSArray, NSDictionary, NSURL, NSNull, NSDate |
|---|---|
key |
An NSCopying key to store the object at |
Declared In
SFUserAccount.h
– removeCustomDataObjectForKey:
Remove a custom data object for a key
- (void)removeCustomDataObjectForKey:(id)keyParameters
key |
The key for the object to remove |
|---|
Declared In
SFUserAccount.h
– customDataObjectForKey:
Retrieve the object stored in the custom data dictionary
- (nullable id)customDataObjectForKey:(id)keyParameters
key |
The key for the object to retrieve |
|---|
Return Value
The object for a particular key
Declared In
SFUserAccount.h
– setPhoto:completion:
Sets the user’s photo.
- (void)setPhoto:(UIImage *_Nullable)photo completion:(void ( ^ __nullable ) ( NSError *_Nullable ))completionParameters
photo |
The user photo, usually the thumbnail of the user. |
|---|---|
completion |
Optional callback block invoked when the photo has been set. If not set, an error is returned. |
Declared In
SFUserAccount.h
Extension Methods
– transitionToLoginState:
Attempts to transition from the current login state to the new login state.
- (BOOL)transitionToLoginState:(SFUserAccountLoginState)newLoginStateParameters
newLoginState |
The new login state to set. |
|---|
Return Value
YES if the login state change was successful, NO otherwise.
Discussion
Only certain state transitions are allowed. For example, you cannot transition
from SFUserAccountLoginStateNotLoggedIn to SFUserAccountLoginStateNotLoggingOut, but
you can transition from SFUserAccountLoginStateNotLoggedIn to SFUserAccountLoginStateLoggedIn.
Declared In
SFUserAccount+Internal.h