evgenyneu / keychain-swift

Helper functions for saving text in Keychain securely for iOS, OS X, tvOS and watchOS.
MIT License
2.82k stars 345 forks source link

Two Warnings in Source Code #115

Closed LawrenceYYS closed 4 years ago

LawrenceYYS commented 5 years ago
    var value: String {
      switch self {

      ......

      case .accessibleAlways:
        return toString(kSecAttrAccessibleAlways)
      //Xcode shows "'kSecAttrAccessibleAlways' was deprecated in iOS 12.0: Use an accessibility level that provides some user protection, such as kSecAttrAccessibleAfterFirstUnlock"

      case .accessibleWhenPasscodeSetThisDeviceOnly:
        return toString(kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly)

      case .accessibleAlwaysThisDeviceOnly:
        return toString(kSecAttrAccessibleAlwaysThisDeviceOnly)
      //Xcode shows "'kSecAttrAccessibleAlwaysThisDeviceOnly' was deprecated in iOS 12.0: Use an accessibility level that provides some user protection, such as kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly"
      }
  }

So I wonder whether I should change the code to the suggested option? Will that be different from what you want to achieve actually?

evgenyneu commented 5 years ago

@YunyushuLiu, it looks like new iOS version will no longer allow unsafe storage options kSecAttrAccessibleAlways and accessibleAlwaysThisDeviceOnly. So I would suggest to remove those two cases from the switch.

evgenyneu commented 5 years ago

Alternatively, instead of using the file installation, you can install this library with CocoaPods, Carthage or Swift Package Manager, it should not show those warnings (I hope).

evgenyneu commented 4 years ago

This has been fixed in version 18 of the library. Let me know if anyone still has an issue.