Keychain value returns empty string

I am using KeychainItemWrapper class to store and retrieve the value in Keychain. On random scenario I am getting Keychain value as a empty string from Keychain store.


In KeychainItemWrapper class mentioned that this class is provided by Apple. Please correct me if i am wrong.


I googled for the the solution and added the following code in KeychainItemWrapper class:


==> [updateItem setObject:(id)kSecAttrAccessibleAfterFirstUnlock forKey:(id)kSecAttrAccessible];


instead of :


==>[updateItem setObject:(id)kSecAttrAccessibleWhenUnlocked forKey:(id)kSecAttrAccessible];


in "writeToKeychain" method. But this code is not getting executed when Keychain returns empty value string.


Please help me to resolve this issue.


Most of keychain empty happening iOS 10.3.2

Did you manage to find any solution? We're having the same exact problem, but can't find why we're getting empty strings sometimes (totally random). I don't think the problem is the access to the keychain, because there is no exception thrown, it simply returns empty strings.

We also seem to be experiencing this issue. Has anyone found a solution to this?


Thanks

Keychain value returns empty string
 
 
Q