Reputation: 20556
I'm using this iOS library to handle storing and getting values in the iOS Keychain. Below is the main code I'm using to store a value in the keychain.
let email: String = emailTextField.text!
let keychain = KeychainSwift()
keychain.set(email, forKey: "email")
I'm trying to set values in the keychain to store the users email and password. The code above is only for email. Right after that code I have set a breakpoint and running p keychain.get("email")
returns nil
in the console. p keychain.lastResultCode
returns -25300
. Even after trying to quit the app and get the data again it still doesn't seem to be working. Any ideas why it would be returning nil
? Just for reference I'm using the iPhone Simulator running Xcode 8.
Upvotes: 0
Views: 1900
Reputation: 1413
You have to turn on Keychain Sharing capability in order for the simulator to work.
This seems to be a known bug. You can read up more on here. https://forums.developer.apple.com/message/179846
Upvotes: 3