In one of my iOS app, I am seeing multiple crashes while accessing the Keychain (in both cases i.e. setting an item & getting an item) and the error code is 25308.
Few details:
1) I am using a 3rd party keychain wrapper https://github.com/kishikawakatsumi/KeychainAccess
2) The accessibility option is set to 'whenUnlockedThisDeviceOnly'
3) This is not happening to all users. I am unable to reproduce it by any chance.
4) I am accessing keychain at few places in AppDelegate. Few crashes are reported on app launch and few are reported on Firebase token refresh notification observer method.
5) In didFinishLaunch, I am trying to access the value for a keychain item where as in Firebase token refresh, I am trying to set the new token value to the keychain.
On my findings I understood that this error code 25308 will be returned when user tries to access the keychain when a device is in locked state. But my Fabric (crash reporting tool) shows that the 'App is in Focus' in all these crashes.
So this got me confused with multiple questions like:
1) What else cases can throw this error 25308 other than device unlocked state?
2) Does firebase token refresh notification causes this background launching of app ? If so, how can I reproduce this. (One supporting thing here is I know that app was not uninstalled)
Update on 01/03:
It seems like the root cause for this is 'App is being launched when Firebase generates a new token and this launch is happening when device is in locked state, hence keychain access is throwing such error 25308.' So is anyone aware how a new firebase token launches the app which is already in terminated state??
Appreciate your responses on this. Thanks..