I'm using the following code to store a Keychain item:
SecAccessControlCreateWithFlags(
kCFAllocatorDefault,
kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
.biometryAny,
&error
)
One of my app users reported an issue:
1. The user navigated to his iPhone’s Face ID settings and click `Reset Face ID`.
2. Then, before he set new Face ID, he accidentally tapped the "Back" button and returned to the iPhone Settings page.
3. He later reopened the Face ID setup page and completed the process.
4. Upon returning to my app, the Keychain item secured by Face ID was no longer found.
I understand that .biometryAny may cause Keychain items to become invalidated when biometric data is reset. However, the user’s scenario — where the setup was temporarily interrupted — seems to have caused the item to disappear.
1. Is there a way to detect and handle such interruptions to prevent the Keychain item from being lost?
2. How can I design a better experience to guide the user in recreating the Keychain item when this occurs?