Explorar o código

Added iOS 7+ support

Yuka Ezura %!s(int64=9) %!d(string=hai) anos
pai
achega
f28511e42b
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      Distrib/KeychainSwiftDistrib.swift

+ 6 - 1
Distrib/KeychainSwiftDistrib.swift

@@ -314,6 +314,7 @@ public enum KeychainSwiftAccessOptions {
   This is recommended for items that only need to be accessible while the application is in the foreground. Items with this attribute never migrate to a new device. After a backup is restored to a new device, these items are missing. No items can be stored in this class on devices without a passcode. Disabling the device passcode causes all items in this class to be deleted.
   
   */
+  @available(iOS 8, *)
   case AccessibleWhenPasscodeSetThisDeviceOnly
   
   /**
@@ -347,7 +348,11 @@ public enum KeychainSwiftAccessOptions {
       return toString(kSecAttrAccessibleAlways)
       
     case .AccessibleWhenPasscodeSetThisDeviceOnly:
-      return toString(kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly)
+      if #available(iOS 8.0, *) {
+        return toString(kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly)
+      } else {
+        fatalError("'kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly' is only available on iOS 8.0 or newer")
+      }
       
     case .AccessibleAlwaysThisDeviceOnly:
       return toString(kSecAttrAccessibleAlwaysThisDeviceOnly)