-
Notifications
You must be signed in to change notification settings - Fork 340
Cannot seem to save two keys #3
Comments
This lib should work fine saving multiple values. I'll try and dig into this sometime today or tonight and see whats up. |
Let me preface this by saying I'm a total beginner at Swift programming so forgive my ignorance in advance. I did some low grade debugging and noticed that in let status: OSStatus = SecItemAdd(keychainQueryDictionary, nil)
if status == errSecSuccess {
return true
} else if status == errSecDuplicateItem {
return self.updateData(value, forKey: keyName)
} else {
return false
} It seems like that "apiURL" section always gets a |
I just threw in a couple more tests to cover adding multiple strings and updating the save key with different strings. Both are working for me. I'd suggest pulling down my updates and running the tests to make sure you're getting the same results. For the duplicate issue, are you sure your key names are unique? If you try to save twice to the same key name, you'll hit the duplicate item error status and its going to instead perform an update. Perhaps while debugging, when you get to the duplicate item status return, check what the keyName value is on the next line each time and see if you're saving to the same keyName by accident. |
The code at the top is exactly what I am using. But I did think of something. I am using this in an OS X application and not in an iOS app. I wonder if the underlying API is different enough on the two platforms that it is causing issues. |
I haven't actually tested this with OS X. But I know there are differences between how keychain is handled on OS X and iOS, so that is most likely the cause of you issue. |
Closing, as the issue is related to accessing Keychain in OS X, which is not the same as on iOS and out of scope of this library for now. |
If I do the following code:
The
apiURL
will always fail no matter what. Is it just that this lib only allows saving of a single item?The text was updated successfully, but these errors were encountered: