#import <CPUserDefaults.h>
Class Methods | |
(void) | + resetStandardUserDefaults |
(id) | + standardUserDefaults |
![]() | |
(BOOL) | + accessInstanceVariablesDirectly |
(id) | + alloc |
(id) | + allocWithCoder: |
(BOOL) | + automaticallyNotifiesObserversForKey: |
(void) | + cancelPreviousPerformRequestsWithTarget: |
(void) | + cancelPreviousPerformRequestsWithTarget:selector:object: |
(Class) | + class |
(BOOL) | + conformsToProtocol: |
(void) | + exposeBinding: |
(void) | + initialize |
(IMP) | + instanceMethodForSelector: |
(BOOL) | + instancesImplementSelector: |
(BOOL) | + instancesRespondToSelector: |
(BOOL) | + isBindingExclusive: |
(BOOL) | + isSubclassOfClass: |
(CPSet) | + keyPathsForValuesAffectingValueForKey: |
(void) | + load |
(id) | + new |
(void) | + object:performSelector:withObject:afterDelay:inModes: |
(void) | + setVersion: |
(Class) | + superclass |
(int) | + version |
CPUserDefaults provides a way of storing a list of user preferences. Everything you store must be CPCoding compliant because it is stored as CPData.
Unlike in Cocoa, CPUserDefaults is per-host by default because of the method of storage. By default, the localStorage API will be used if the browser supports it. Otherwise a cookie fallback mechanism is utilized. Be aware that if the user erases the local database or clears their cookies, all the preferences will be lost. Also be aware that this is not a safe storage method; do not store sensitive data in the defaults database.
The storage method utilized is determined by matching the writing domain to a dictionary of stores, concrete subclasses of the CPUserDefaultsStore abstract class. This is a deviation from Cocoa. You can create a custom defaults store by subclassing the abstract class and implementing the protocol. Currently the protocol consists of only two methods: -data and -setData:. The latter needs to store the passed in CPData object in your storage mechanism and the former needs to return an equivalent CPData object synchronously. You can then configure CPUserDefaults to use your storage mechanism using -setPersistentStoreClass:forDomain:reloadData:
Definition at line 2 of file CPUserDefaults.h.
|
implementation |
Returns the array value associated with the specified key.
Definition at line 374 of file CPUserDefaults.j.
|
implementation |
Returns the Boolean value associated with the specified key.
Definition at line 386 of file CPUserDefaults.j.
Returns the data object associated with the specified key.
Definition at line 399 of file CPUserDefaults.j.
|
implementation |
Returns the Boolean value associated with the specified key.
Definition at line 411 of file CPUserDefaults.j.
|
implementation |
Definition at line 341 of file CPUserDefaults.j.
|
implementation |
Returns the double value associated with the specified key.
Definition at line 453 of file CPUserDefaults.j.
|
implementation |
Returns the float value associated with the specified key.
Definition at line 423 of file CPUserDefaults.j.
|
implementation |
Initializes the receiver
Reimplemented from CPObject.
Definition at line 87 of file CPUserDefaults.j.
|
implementation |
Returns the integer value associated with the specified key.
Definition at line 438 of file CPUserDefaults.j.
|
implementation |
Return a default value. The order of domains in the search list is: CPRegistrationDomain, CPGlobalDomain, CPApplicationDomain, CPArgumentDomain. Calling this method may cause the search list to be recreated if any new values have recently been set. Be aware of the performance ramifications.
Definition at line 127 of file CPUserDefaults.j.
|
implementation |
Return a default value from a specific domain. If you know which domain you'd like to use you should always use this method because it doesn't have to hit the search list.
Definition at line 148 of file CPUserDefaults.j.
|
implementation |
Returns an array of currently persistent domain names.
Definition at line 285 of file CPUserDefaults.j.
|
implementation |
Returns the currently used instance of CPUserDefaultStore concrete subclass for the given domain name.
Definition at line 293 of file CPUserDefaults.j.
|
implementation |
Adds the contents the specified dictionary to the registration domain.
If there is no registration domain, one is created using the specified dictionary, and CPRegistrationDomain is added to the end of the search list. The contents of the registration domain are not written to disk; you need to call this method each time your application starts. You can place a plist file in the application's Resources directory and call registerDefaultsWithContentsOfFile:
aDictionary | The dictionary of keys and values you want to register. |
Definition at line 213 of file CPUserDefaults.j.
|
implementation |
This is just a convenience method to load a plist resource and register all the values it contains as defaults.
NOTE: This sends a synchronous request. If you don't want to do that, create a dictionary any way you want (including loading a plist) and pass it to -registerDefaults:
Definition at line 232 of file CPUserDefaults.j.
|
implementation |
Definition at line 325 of file CPUserDefaults.j.
|
implementation |
Removes the value of the specified default key in the standard application domain. Removing a default has no effect on the value returned by the objectForKey: method if the same key exists in a domain that precedes the standard application domain in the search list.
Definition at line 183 of file CPUserDefaults.j.
|
implementation |
Removes the value of the specified default key in the specified domain.
Definition at line 191 of file CPUserDefaults.j.
|
implementation |
Synchronizes any changes made to the shared user defaults object and releases it from memory. A subsequent invocation of standardUserDefaults creates a new shared user defaults object with the standard search list.
Definition at line 76 of file CPUserDefaults.j.
|
implementation |
Sets the value of the specified default key to the specified Boolean value. A cast will be attempted with -boolValue.
Definition at line 511 of file CPUserDefaults.j.
|
implementation |
Sets the value of the specified default key to the double value.
Definition at line 532 of file CPUserDefaults.j.
|
implementation |
Sets the value of the specified default key to the specified float value. A cast will be attempted with -floatValue and parseFloat().
Definition at line 521 of file CPUserDefaults.j.
|
implementation |
Sets the value of the specified default key to the specified integer value. A cast will be attempted with -intValue and parseInt().
Definition at line 541 of file CPUserDefaults.j.
|
implementation |
Set a default value in your application domain.
Definition at line 138 of file CPUserDefaults.j.
|
implementation |
Set a default value in the domain you pass in. If the domain is CPApplicationDomain or CPGlobalDomain, the defaults store will eventually be persisted. You can call -forceFlush to force a persist.
Definition at line 162 of file CPUserDefaults.j.
|
implementation |
Set the CPUserDefaultStore concrete subclass that should be instantiated for use in persisting the given domain name.
aStoreClass | The concrete subclass of CPUserDefaultsStore to use to store the defaults database for this domain |
aDomain | The name of the domain for which you want to change the storage mechanism |
reloadData | Empty the cached defaults for this domain and reload them from the new storage mechanism |
Definition at line 306 of file CPUserDefaults.j.
Sets the value of the specified default key to the specified URL. The adjustments made in Cocoa are not present here.
Definition at line 553 of file CPUserDefaults.j.
|
implementation |
Returns the shared defaults object.
Definition at line 64 of file CPUserDefaults.j.
|
implementation |
Returns the string array value associated with the specified key.
Definition at line 477 of file CPUserDefaults.j.
Returns the string value associated with the specified key.
Definition at line 461 of file CPUserDefaults.j.
|
implementation |
Force write out of defaults database immediately.
Definition at line 352 of file CPUserDefaults.j.
Returns the CPURL value associated with the specified key.
Definition at line 493 of file CPUserDefaults.j.
|
implementation |
Returns an array of currently volatile domain names.
Definition at line 277 of file CPUserDefaults.j.