ArcGIS Runtime SDK for iOS
100.15
|
A convenience class to store and retrieve objects in the keychain.
This class represents a generic keychain item which can store objects securely and retrieve them from the keychain. The object must implement NSCoding
. For example, you can store an AGSCredential
representing a user's identity and retrieve it when the app is restarted so that the user does not have to log in again.
@define{AGSKeychainItem, ArcGIS}
Instance Methods | |
(instancetype) | - initWithIdentifier:accessGroup:acrossDevices: |
(instancetype) | - initWithIdentifier:accessGroup:acrossDevices:accessible: |
(nullable id< NSCoding >) | - readObjectFromKeychain |
(void) | - removeObjectFromKeychainWithCompletion: |
(void) | - writeObjectToKeychain:completion: |
Class Methods | |
(instancetype) | + keychainItemWithIdentifier:accessGroup:acrossDevices: |
(instancetype) | + keychainItemWithIdentifier:accessGroup:acrossDevices:accessible: |
Properties | |
NSString * | accessGroup |
NSString * | identifier |
BOOL | sharedAcrossDevices |
- (instancetype) initWithIdentifier: | (NSString *) | identifier | |
accessGroup: | (nullable NSString *) | accessGroup | |
acrossDevices: | (BOOL) | acrossDevices | |
Initialize the keychain item with given identifier, access group and shared across devices.
identifier | Must be unique, for example - com.acme.appname |
accessGroup | If you want the new keychain item to be shared among multiple applications, the value of this key must be the name of a keychain access group to which all of the programs that will share this item belong. Otherwise, nil. |
acrossDevices | If you want to share the keychain item across devices using iCloud Keychain then set to YES. The iCloud Keychain must be enabled on device to make this work. |
- (instancetype) initWithIdentifier: | (NSString *) | identifier | |
accessGroup: | (nullable NSString *) | accessGroup | |
acrossDevices: | (BOOL) | acrossDevices | |
accessible: | (AGSKeychainItemAccessible) | accessible | |
Initialize the keychain item with given identifier, access group and shared across devices.
identifier | Must be unique, for example - com.acme.appname |
accessGroup | If you want the new keychain item to be shared among multiple applications, the value of this key must be the name of a keychain access group to which all of the programs that will share this item belong. Otherwise, nil. |
acrossDevices | If you want to share the keychain item across devices using iCloud Keychain then set to YES. The iCloud Keychain must be enabled on device to make this work. |
accessible | Indicates when a keychain item is accessible. If acrossDevices is YES, the valid options are only those which do not end with ThisDeviceOnly, as those cannot sync to another device. For macOS, this works only if acrossDevices is YES. You cannot change this option for an existing item. The keychain item will always be persisted with the option you first provided. To change this option, you first have to remove the existing keychain item using removeObjectFromKeychainWithCompletion: . |
+ (instancetype) keychainItemWithIdentifier: | (NSString *) | identifier | |
accessGroup: | (nullable NSString *) | accessGroup | |
acrossDevices: | (BOOL) | acrossDevices | |
Initialize the keychain item with given identifier, access group and shared across devices.
identifier | Must be unique, for example - com.acme.appname |
accessGroup | If you want the new keychain item to be shared among multiple applications, the value of this key must be the name of a keychain access group to which all of the programs that will share this item belong. Otherwise, nil. |
acrossDevices | If you want to share the keychain item across devices using iCloud Keychain then set to YES. The iCloud Keychain must be enabled on device to make this work. |
+ (instancetype) keychainItemWithIdentifier: | (NSString *) | identifier | |
accessGroup: | (nullable NSString *) | accessGroup | |
acrossDevices: | (BOOL) | acrossDevices | |
accessible: | (AGSKeychainItemAccessible) | accessible | |
Initialize the keychain item with given identifier, access group and shared across devices.
identifier | Must be unique, for example - com.acme.appname |
accessGroup | If you want the new keychain item to be shared among multiple applications, the value of this key must be the name of a keychain access group to which all of the programs that will share this item belong. Otherwise, nil. |
acrossDevices | If you want to share the keychain item across devices using iCloud Keychain then set to YES. The iCloud Keychain must be enabled on device to make this work. |
accessible | Indicates when a keychain item is accessible. If acrossDevices is YES, the valid options are only those which do not end with ThisDeviceOnly, as those cannot sync to another device. For macOS, this works only if acrossDevices is YES. You cannot change this option for an existing item. The keychain item will always be persisted with the option you first provided. To change this option, you first have to remove the existing keychain item using removeObjectFromKeychainWithCompletion: . |
- (nullable id<NSCoding>) readObjectFromKeychain |
Retrieve the archivable object from the kSecValueData in the keychain item
- (void) removeObjectFromKeychainWithCompletion: | (nullable void(^)(NSError *__nullable error)) | completion |
Removes generic keychain item data.
completion | block that is invoked when the operation completes. The error argument will be populated if a problem is encountered while removing the item from the keychain. |
- (void) writeObjectToKeychain: | (id< NSCoding >) | object | |
completion: | (nullable void(^)(NSError *__nullable error)) | completion | |
Set an archivable object as the kSecValueData
in the keychain item.
object | The archivable object to store in the keychain. |
completion | block that is invoked when the operation completes. The error argument will be populated if a problem is encountered while storing the item in the keychain. |
|
readnonatomiccopy |
Use keychain access group to share keychain item among multiple applications. It is used when synchronizing and persisting the cache with the keychain.
#initWithIdentifier:accessGroup:acrossDevices:acrossDevices:
|
readnonatomiccopy |
The keychain identifier is used when synchronizing and persisting the cache with the keychain.
|
readnonatomicassign |
Indicates whether keychain item is shared across devices using iCloud Keychain or not.
#initWithIdentifier:accessGroup:acrossDevices:acrossDevices: