Search code examples
iosbackground-fetch

What happens on using deprecated kSecAttrAccessibleAlwaysThisDeviceOnly?


It seems kSecAttrAccessibleAlwaysThisDeviceOnly has been deprecated what happens on using it?

What is the alternative?


Solution

  • The most obvious alternative is to use kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly.

    After the first unlock, the data remains accessible until the next restart. This is recommended for items that need to be accessed by background applications. Items with this attribute do not migrate to a new device. Thus, after restoring from a backup of a different device, these items will not be present.

    However, I'd recommend reading the following from Apple - https://developer.apple.com/documentation/security/keychain_services/keychain_items/item_attribute_keys_and_values - there's several options that might be more appropriate.