Reputation: 4365
I am using Locksmith
as my keychain wrapper for Swift, But it shows the following error when try to save data
The operation couldn’t be completed. (Locksmith.LocksmithError error 3.)
Here is the code that I am trying to save data to keychain
let datapair = ["Content": "value"]
do {
try Locksmith.saveData(data: datapair, forUserAccount: "key")
} catch let error {
print(error.localizedDescription)
}
Any solutions or suggestions should be appreciated
Upvotes: 2
Views: 351
Reputation: 5223
Error 3 occurs when the Keychain entry already exists. For the second time when you update the data, use
try Locksmith.updateData(data: datapair, forUserAccount: "key")
Upvotes: 5