evgenyneu / keychain-swift

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

Value is delete sometime unexpectedly #110

Open trieuhellodenteam opened 5 years ago

trieuhellodenteam commented 5 years ago

Please consider submitting the following information (if relevant):

I used keychain for store identifier device

` class IOSDeviceManager {

static let shared = IOSDeviceManager()
var identifier: String {
    if let deviceId = keychain.get(deviceIdString) {
        return deviceId
    } else {
        let deviceId = UIDevice.current.identifierForVendor?.uuidString ?? ""
        keychain.set(deviceId, forKey: deviceIdString)
        return deviceId
    }
}

}

`

It worked perfect when I uninstalled then reinstall. But I don't know sometime IOSDeviceManager.shared. identifier get new value. Do you know any reason?

evgenyneu commented 5 years ago

Hi, thanks for reporting. This could be related to #15. Sometimes the Keychain returns nil, there is a potential workaround in #78.