Эх сурвалжийг харах

Fix access group and removeAll() method do not work correctly

kishikawa katsumi 10 жил өмнө
parent
commit
05dc51be95

+ 3 - 2
Lib/KeychainAccess/Keychain.swift

@@ -349,7 +349,7 @@ public class Keychain {
     
     
     public func removeAll() throws {
     public func removeAll() throws {
         var query = options.query()
         var query = options.query()
-        #if !os(iOS)
+        #if !os(iOS) && !os(watchOS)
         query[kSecMatchLimit as String] = kSecMatchLimitAll
         query[kSecMatchLimit as String] = kSecMatchLimitAll
         #endif
         #endif
         
         
@@ -788,7 +788,8 @@ extension Options {
         switch itemClass {
         switch itemClass {
         case .GenericPassword:
         case .GenericPassword:
             query[kSecAttrService as String] = service
             query[kSecAttrService as String] = service
-            #if (!arch(i386) && !arch(x86_64)) || !os(iOS)
+            // Access group is not supported on any simulators.
+            #if (!arch(i386) && !arch(x86_64)) || (!os(iOS) && !os(watchOS))
             if let accessGroup = self.accessGroup {
             if let accessGroup = self.accessGroup {
                 query[kSecAttrAccessGroup as String] = accessGroup
                 query[kSecAttrAccessGroup as String] = accessGroup
             }
             }