ErrSecDefault for iOS keychain password access

I am using SSKeychain as a wrapper to store the user access token and user id.

I make a web request for my user access token during registration and then I call [SSKeychain setPassword:@"password" forService:@"myService" account:@"myAccount"]

However, when I try to access the password using [SSKeychain passwordForService:@"myService" account:@"myAccount" error:&error]

, I get null, and when I log an error, I get errSecDefault.

I did some online research on errSecDefault and I watched the SSKeychain documentary as well as questions on github. It looks like others have the same problem, but I haven't found a solution. It also seems to be something inherent in Keychain and not a wrapper (based on what I read from the problematic threads).

Has anyone encountered this error using keychain and figured out how it even means?

+3


source to share


1 answer


I faced the same problem because I was accessing the keychain too often. Like userdefaults, this is not a data store.



I wrote a wrapper that stored the token locally in a variable and only accessed the keychain when changes were made to where they were made and returned the locally stored token / password otherwise. This solved it for me.

+1


source







All Articles