Show / Hide Table of Contents

Class ISN_NSUbiquitousKeyValueStore

An iCloud-based container of key-value pairs you use to share data among instances of your app running on a user's connected devices. Use the iCloud key-value store to make preference, configuration, and app-state data available to every instance of your app on every device connected to a user’s iCloud account. You can store scalar values such as BOOL, as well as values containing any of the property list object types: NSNumber, NSString, NSDate, NSData, NSArray, and NSDictionary.

Inheritance
System.Object
ISN_NSUbiquitousKeyValueStore
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: SA.iOS.Foundation
Assembly: cs.temp.dll.dll
Syntax
public static class ISN_NSUbiquitousKeyValueStore

Properties

StoreDidChangeExternallyNotification

Posted when the value of one or more keys in the local key-value store changed due to incoming data pushed from iCloud. This notification is sent only upon a change received from iCloud; it is not sent when your app sets a value.

Declaration
public static SA_Event<ISN_NSStoreDidChangeExternallyNotification> StoreDidChangeExternallyNotification { get; }
Property Value
Type Description
SA_Event<ISN_NSStoreDidChangeExternallyNotification>

Methods

KeyValueStoreObjectForKey(String)

The object associated with the specified key or string value "null" if the key was not found.

Declaration
public static ISN_NSKeyValueObject KeyValueStoreObjectForKey(string key)
Parameters
Type Name Description
System.String key
Returns
Type Description
ISN_NSKeyValueObject

Reset()

Removes all keys and values from the iCloud key-value storage. Use with caution.

Declaration
public static void Reset()

SetBool(String, Boolean)

Sets a bool object for the specified key in the key-value store.

Declaration
public static void SetBool(string key, bool value)
Parameters
Type Name Description
System.String key
System.Boolean value

SetBytes(String, Byte[])

Sets a bytes array for the specified key in the key-value store.

Declaration
public static void SetBytes(string key, byte[] value)
Parameters
Type Name Description
System.String key
System.Byte[] value

SetDateTime(String, DateTime)

Sets a DateTime object for the specified key in the key-value store.

Declaration
public static void SetDateTime(string key, DateTime value)
Parameters
Type Name Description
System.String key
DateTime value

SetFloat(String, Single)

Sets a float object for the specified key in the key-value store.

Declaration
public static void SetFloat(string key, float value)
Parameters
Type Name Description
System.String key
System.Single value

SetInt(String, Int32)

Sets a int object for the specified key in the key-value store.

Declaration
public static void SetInt(string key, int value)
Parameters
Type Name Description
System.String key
System.Int32 value

SetLong(String, Int64)

Sets a long object for the specified key in the key-value store.

Declaration
public static void SetLong(string key, long value)
Parameters
Type Name Description
System.String key
System.Int64 value

SetObject(String, Object)

Sets an object for the specified key in the key-value store. Set object serialized using

Declaration
public static void SetObject(string key, object obj)
Parameters
Type Name Description
System.String key
System.Object obj

SetString(String, String)

Sets a string object for the specified key in the key-value store.

Declaration
public static void SetString(string key, string value)
Parameters
Type Name Description
System.String key
System.String value

SetULong(String, UInt64)

Sets a ulong object for the specified key in the key-value store.

Declaration
public static void SetULong(string key, ulong value)
Parameters
Type Name Description
System.String key
System.UInt64 value

Synchronize()

Explicitly synchronizes in-memory keys and values with those stored on disk. YES if the in-memory and on-disk keys and values were synchronized, or NO if an error occurred. For example, this method returns NO if an app was not built with the proper entitlement requests.

The only recommended time to call this method is upon app launch, or upon returning to the foreground, to ensure that the in-memory key-value store representation is up-to-date.

Changes you make to the key-value store are saved to memory. The system then synchronizes the in-memory keys and values with the local on-disk cache, automatically and at appropriate times. For example, it synchronizes the keys when your app is put into the background, when changes are received from iCloud, and when your app makes changes to a key but does not call the synchronize method for several seconds. This method does not force new keys and values to be written to iCloud.

Rather, it lets iCloud know that new keys and values are available to be uploaded. Do not rely on your keys and values being available on other devices immediately. The system controls when those keys and values are uploaded. The frequency of upload requests for key-value storage is limited to several per minute.

During synchronization between memory and disk, this method updates your in-memory set of keys and values with changes previously received from iCloud.

Declaration
public static bool Synchronize()
Returns
Type Description
System.Boolean
In This Article
Back to top Generated by DocFX