Closed Ram-Knoxville closed 6 years ago
I run a couple of processes when the phone is locked, and this issue is really complicating things up for me. Is causing my app to crash since it finds nil on key values previously saved
Are you trying to access the keys while the phone is locked or you mean after unlocking it they are gone? By default, keychain wrapper saves items to only be accessible when the device is unlocked. If you want to change the default accessibility, you can pass it as a parameter on your set requests. See KeychainItemAccessibility for the different options.
Can you give me an example of how to pass it as a parameter? i tried this KeychainWrapper.standard.set(deviceModel, forKey: "deviceModel", KeychainItemAccessibility: kSecAttrAccessibleAlways)
but it wouldnt let me
Thanks in advance @jrendel
I also found out that if my phone doesn't have a unlock password it works perfectly on background, but as soon as i add a passcode to my phone, the Keys disappear
I think what you are looking for is:
KeychainWrapper.standard.set(deviceModel, forKey: "deviceModel", KeychainItemAccessibility: .always)
@jrendel that works, the team I work with found it to be a solution for this problem.
Everytime i lock my iphone all my keys go away for some reason.
is there a way to fix this ?
Thanks in advance