Earlier than posting this query, I’ve went by means of most of comparable questions associated to Keychain entry. However I could not discover any correct reply.
I’ve an iOS app utilizing Keychain, that shops accesstoken in Keychain.
In Manufacturing, I can see from the logs that for small share of customers, Keychain returns ‘errSecItemNotFound’ when accessing Keychain after app launch.
Its arduous to breed this state of affairs.
I’ve gone by means of beneath article, that proposes to make use of ‘protectedDataAvailableNotification’, however Apple documentation says this can be true provided that the app is unlocked. However I must entry the keychain even in background & locked states.
https://medium.com/@yoav.ziv/userdefaults-value-returns-nil-although-its-shouldn-t-d55ddf832564
-
Is there any setup must do for accessing Keychain after app launch?
-
Beneath is the question used to entry merchandise from keychain. It has ‘kSecAttrService’ saves the important thing title and ‘kSecAttrAccount’ is all the time empty. Is it right?
var defaults: [CFString: Any] = [ kSecClass: kSecClassGenericPassword, kSecAttrService: service, kSecAttrAccount: "", ] defaults[kSecAttrAccessGroup] = accessGroup defaults[kSecMatchLimit] = kSecMatchLimitOne defaults[kSecReturnData] = kCFBooleanTrue defaults[kSecAttrAccessible] = kSecAttrAccessibleAfterFirstUnlock }
Any assist can be appreciated.