Jelajahi Sumber

check without UI

Marco Cancellieri 7 tahun lalu
induk
melakukan
5c0e08ebc5
1 mengubah file dengan 6 tambahan dan 1 penghapusan
  1. 6 1
      Lib/KeychainAccess/Keychain.swift

+ 6 - 1
Lib/KeychainAccess/Keychain.swift

@@ -744,11 +744,16 @@ public final class Keychain {
     public func contains(_ key: String) throws -> Bool {
         var query = options.query()
         query[AttributeAccount] = key
-
+        if #available(iOSApplicationExtension 9.0, *) {
+            query[UseAuthenticationUI] = UseAuthenticationUIFail
+        }
+        
         let status = SecItemCopyMatching(query as CFDictionary, nil)
         switch status {
         case errSecSuccess:
             return true
+        case errSecInteractionNotAllowed:
+            return true
         case errSecItemNotFound:
             return false
         default: