Failure to read the Keychain on iOS 13 Simulator
Originator: | serieuxchat | ||
Number: | rdar://7251207 | Date Originated: | 11-09-2019 |
Status: | Open | Resolved: | |
Product: | iOS Simulator | Product Version: | 13 |
Classification: | Reproducible: | Always |
When access control is specified (with biometrics), iOS13 Simulator fails to read data from the Keychain. // If run on iOS12 Simulator, status2 will be 0 // If run on iOS13 Simulator, status2 will be -25300 func testKeychain() { let tag = "com.flockoffiles.testkeychain.value" let savedData = "testString".data(using: .utf8)! var aclError: Unmanaged<CFError>? let accessControl = SecAccessControlCreateWithFlags(kCFAllocatorDefault, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, SecAccessControlCreateFlags.biometryCurrentSet, &aclError)! let query: [String : Any] = [kSecClass as String: kSecClassGenericPassword, kSecAttrAccount as String: tag, kSecAttrService as String: tag, kSecAttrAccessControl as String: accessControl, kSecValueData as String: savedData] var status = SecItemAdd(query as CFDictionary, nil) if status == errSecDuplicateItem { let updateQuery: [String: Any] = [kSecValueData as String: savedData] status = SecItemUpdate(query as CFDictionary, updateQuery as CFDictionary) } let query2: [String : Any] = [kSecClass as String: kSecClassGenericPassword, kSecAttrAccount as String: tag, kSecAttrService as String: tag, kSecReturnData as String: kCFBooleanFalse!, kSecUseAuthenticationUI as String: kSecUseAuthenticationUIFail] var result: CFTypeRef? let status2 = SecItemCopyMatching(query2 as CFDictionary, &result) // If run on iOS12 Simulator, status2 will be 0 // If run on iOS13 Simulator, status2 will be -25300 print("Query2 status: \(status2)") }
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Re-tested on Xcode 11.4
iOS 13.5 Simulator (iPhone 11 Pro) - works. iOS 12.1 Simulator (iPhone SE 1st gen) - works.
Feedback please
Hi,
Still occurring in Xcode 11.3.1 (11C504), is there any solution / workaround for this issue or expected fix?
Hi,
Still reproduced on Xcode 11.3 / iOS 13.3 Simulator. Any feedback from Apple?
Any feedback?
Hi,
Have you got any feedback related to the bug? Thanks.