Open gurtejsmartdata opened 1 year ago
I am getting this too on IOS. Seems like we need a fix.
hi i'm getting this too and I'm wondering if it's because I implemented the code block in the "Note Reading Keychain Persistence" section. Did either of you who were running into this issue also follow this suggestion? I think it might be the problem described here - https://stackoverflow.com/questions/20269116/nsuserdefaults-losing-its-keys-values-when-phone-is-rebooted-but-not-unlocked. I'm going to try and disable this code and see if the problem is fixed
did it work?
Need a few more days to gather data and will circle back
I did not implement that. I am still getting the problem - when coming from background to foreground I dont have the saved info.
I was going to try below but several people did not say it worked- one person said it worked.
- (void) applicationProtectedDataDidBecomeAvailable:(UIApplication *)application {
NSLog(@"Application Protected Data Did Become Available");
[NSUserDefaults resetStandardUserDefaults];
}
I have seen this happen quite often, and for quite a while in our app too. We don't have a good way of reproducing this yet. Would appreciate if anyone had any suggestions.
We ended up replacing this package with react-native-keychain
, which seems to have solved the problem. My theory for the problem my team was facings is that on iOS, this package by default writes data to the keychain with a accessibility state that only allows the React Native app t load the secure data when the phone is unlocked (see here - https://developer.apple.com/documentation/security/keychain_services/keychain_items/restricting_keychain_item_accessibility#2974972). For us, this was problematic, because when a user received a notification while their phone was locked (e.g. was in their pocket), the app would start in the background, attempt to load the auth data, and be denied access. react-native-keychain
let us use set the data accessibility option to 'Always Accessible' which got around this issue (albeit at some security risk, but it was acceptable for our purposes).
Not sure if that's what's happening for anyone else here, but figured I would share. Hope this helps!
Thanks for taking the time to reply here @adamzu, that is helpful.
While we don't make any attempts to access app state when the device is locked, I suspect there might be other scenarios that cause the app to attempt to load the store before the keychain is ready.
hi I have issue in accessing encrypted storage on iOS, I get
"code":"-25308","message":"RNEncryptedStorageError: An error occurred while retrieving value"
randomly . Kindly suggest the solution for it