Browse Source

iOS 7 support

Evgenii Neumerzhitckii 9 years ago
parent
commit
259b29965f

+ 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)

+ 6 - 1
KeychainSwift/KeychainSwiftAccessOptions.swift

@@ -61,6 +61,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
   
   
   /**
   /**
@@ -94,7 +95,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)