How to find out whether the user dismiss the credential action sheet or there is no credentials

Hi, I want to implement passkey in my app. I am wondering if there is a robust way to distinguish between these two situations:

  1. the user cancels the action sheet (ASAuthorizationController)
  2. there are no credentials at all

Both situations give a canceled error. I noticed a localized string in NSError.userInfo explaining the reason in situation 2, but this is not a robust way of distinguishing between them because the behavior can change in the future.

Replies

These two cases are not meant to be distinguished programmatically, for privacy reasons, and you're right that the userInfo shouldn't be relied upon. You likely want to either use AutoFill-assisted requests, or perform a modal request with a silent fallback (i.e. no UI gets displayed you get the cancel callback immediately if there are no credentials). These options are displayed in detail in the Meet passkeys developer session.