Browse Source

Added iOS 7+ support

Yuka Ezura 9 years ago
parent
commit
f28511e42b
1 changed files with 6 additions and 1 deletions
  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.
   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
   case AccessibleWhenPasscodeSetThisDeviceOnly
   
   
   /**
   /**
@@ -347,7 +348,11 @@ public enum KeychainSwiftAccessOptions {
       return toString(kSecAttrAccessibleAlways)
       return toString(kSecAttrAccessibleAlways)
       
       
     case .AccessibleWhenPasscodeSetThisDeviceOnly:
     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:
     case .AccessibleAlwaysThisDeviceOnly:
       return toString(kSecAttrAccessibleAlwaysThisDeviceOnly)
       return toString(kSecAttrAccessibleAlwaysThisDeviceOnly)