SecItemAdd returns errSecAuthFailed

Hello,

I'm experiencing a weird issue on the iOS 15 simulator (unfortunately I don't have a device with 15 installed yet).

The issue I see is that the call to SecItemAdd returns OSStatus -25293 (errSecAuthFailed).

The attributes dictionary passed looks like this:

var query: [String : Any] = [
			kSecClass as String: kSecClassGenericPassword,
			kSecAttrAccount as String: key,
			kSecAttrService as String: service,
			kSecAttrAccessControl as String: getSecAccessControl(),
			kSecUseAuthenticationContext as String: context,
			kSecValueData as String: data
        ]

the getSecAccessControl returns a SecAccessControl created like this:

        access = SecAccessControlCreateWithFlags(nil,
			  kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
			  .userPresence,
			  &error)

if I do not add the kSecAttrAccessControl item I don't see any error.

The same code works as expected on the simulator with iOS 14. Looking at the documentation didn't help, anybody has hints about this? Maybe it's bug I'm not aware of?

Thank you in advance

Post not yet marked as solved Up vote post of AlessioP Down vote post of AlessioP
7.6k views
  • Same issue here. It's a relief to read I'm not the only person having this exact issue.

Add a Comment

Replies

Any updates about the issue ?

  • Still occurs in iOS 15.2 simulator, seems to work on physical device.

Add a Comment

I'm still facing the same issue on iOS 15.2 simulator. But it seems that it has been fixed on the iOS 16.0 beta 1 simulator

it seems that it has been fixed on the iOS 16.0 beta 1 simulator

Cool. That matches my expectations based on the info in FB9777739.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"