SFPreferences Class Reference
Inherits from | NSObject |
---|---|
Declared in | SFPreferences.h |
Overview
Preferences class that handles scoped preferences. A scope binds the preferences to a specific user, org or community.
path
Returns the path in which the preferences file exists
@property (nonatomic, strong, readonly) NSString *path
Declared In
SFPreferences.h
dictionaryRepresentation
Returns the underlying dictionary representation
@property (nonatomic, copy, readonly) NSDictionary *dictionaryRepresentation
Declared In
SFPreferences.h
+ globalPreferences
Returns the global instance of the preferences (one per application)
+ (instancetype)globalPreferences
Declared In
SFPreferences.h
+ sharedPreferencesForScope:user:
Returns the preferences instance related to the specified user’s organization or nil if there is no specified user or scope.
+ (nullable instancetype)sharedPreferencesForScope:(SFUserAccountScope)scope user:(nullable SFUserAccount *)user
Parameters
scope |
The scope to which the preferences apply: global, user’s org, user’s community, or user’s account. |
---|---|
user |
The account to which the preferences apply. Not used if scope is global. |
Declared In
SFPreferences.h
+ currentOrgLevelPreferences
Returns the preferences instance related to the current user’s organization or nil if there is no current user.
+ (nullable instancetype)currentOrgLevelPreferences
Declared In
SFPreferences.h
+ currentUserLevelPreferences
Returns the preferences instance related to the currrent user or nil if there is no current user.
+ (nullable instancetype)currentUserLevelPreferences
Declared In
SFPreferences.h
+ currentCommunityLevelPreferences
Returns the preferences instance related to the currrent user’s community or nil if there is no current user.
+ (nullable instancetype)currentCommunityLevelPreferences
Declared In
SFPreferences.h
– objectForKey:
Returns the preferences object for the given key.
- (nullable id)objectForKey:(NSString *)key
Parameters
key |
The key of the requested object. |
---|
Declared In
SFPreferences.h
– setObject:forKey:
Sets the preference object for the given attribute key. Logs an SFLogLevelError if the key is not found.
- (void)setObject:(id)object forKey:(NSString *)key
Parameters
object |
Object to be set. |
---|---|
key |
Key of object to be set. |
Declared In
SFPreferences.h
– removeObjectForKey:
Removes the preference object for the given attribute key.
- (void)removeObjectForKey:(NSString *)key
Parameters
key |
Key of object to be removed. |
---|
Declared In
SFPreferences.h
– keyExists:
Returns a YES if the key exits, otherwise NO.
- (BOOL)keyExists:(NSString *)key
Parameters
key |
THe key to check the existance of. |
---|
Declared In
SFPreferences.h
– boolForKey:
Returns the Boolean preference value for the given key.
- (BOOL)boolForKey:(NSString *)key
Parameters
key |
The key of the requested preference value. |
---|
Declared In
SFPreferences.h
– setBool:forKey:
Assigns the given Boolean preference value to the given key.
- (void)setBool:(BOOL)value forKey:(NSString *)key
Parameters
value |
The Boolean value. |
---|---|
key |
The key of the preference value to be edited. |
Declared In
SFPreferences.h
– integerForKey:
Returns the integer preference value for the given key.
- (NSInteger)integerForKey:(NSString *)key
Parameters
key |
The key of the requested preference value. |
---|
Declared In
SFPreferences.h
– setInteger:forKey:
Assigns the given integer preference value to the given key.
- (void)setInteger:(NSInteger)value forKey:(NSString *)key
Parameters
value |
The integer value. |
---|---|
key |
The key of the preference value to be edited. |
Declared In
SFPreferences.h
– stringForKey:
Returns the string preference value for the given key.
- (nullable NSString *)stringForKey:(NSString *)key
Parameters
key |
The key of the requested preference value. |
---|
Declared In
SFPreferences.h