使用已弃用的 kSecAttrAccessibleAlwaysThisDeviceOnly 会发生什么?

What happens on using deprecated kSecAttrAccessibleAlwaysThisDeviceOnly?

kSecAttrAccessibleAlwaysThisDeviceOnly 似乎已被弃用,使用它会发生什么?

还有什么选择?

最明显的替代方法是使用 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.

不过,我建议您阅读 Apple 的以下内容 - https://developer.apple.com/documentation/security/keychain_services/keychain_items/item_attribute_keys_and_values - 有几个选项可能更合适。