SecItemCopyMatching is only working if called after a delay

Hi,

In my app I want to initiate device passcode authentication. (No need of touch ID, so not using Local authentication). For that I am adding the below query to keychain

      kSecClass: kSecClassGenericPassword,
      kSecAttrAccessControl: secAccessControlbject,
      kSecAttrService: "PasscodeAuthentication",
      kSecValueData: dataToStore as Any,
    ]
     
     SecItemAdd(insertQuery as CFDictionary, nil)

Then at the point where I want to initiate passcode authentication calling bellow method:

let status: OSStatus = SecItemCopyMatching(query, &typeRef)

This was working fine.

But When I initiate method to get the query from a closure it is not working and trowing error code -25293.
If I add a delay before calling this method it is working fine.

Why this is happening ?

This was working fine.

But When I initiate method to get the query from a closure it is not working

If you go back to your original implementation, does it start working again?

Share and Enjoy

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

SecItemCopyMatching is only working if called after a delay
 
 
Q