"BUG IN CLIENT OF LIBPLATFORM: os_unfair_lock is corrupt" crash when calling SecItemCopyMatching

Viewed 897

I'm getting crash reports caused when calling SecItemCopyMatching. I am unable to reproduce the issue, but here's the code causing the crash:

class func load(key: String) -> Data? {
    let query = [
        kSecClass as String: kSecClassGenericPassword,
        kSecAttrAccount as String: key,
        kSecReturnData as String: kCFBooleanTrue!,
        kSecMatchLimit as String: kSecMatchLimitOne ] as [String: Any]

    var dataTypeRef: AnyObject?

    // LINE THAT CRASHES SOMETIMES:
    let status: OSStatus = SecItemCopyMatching(query as CFDictionary, &dataTypeRef) 

    if status == noErr {
        return dataTypeRef as! Data?
    } else {
        return nil
    }
}

I don't quite understand the error message as I'm not taking any locks in that code nor in the calling code. The documentation doesn't seem to warn of any such crashes.

Any ideas?

0 Answers
Related