New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app groups: value undefined until restart #622
Comments
Did you add react-native-mmkv/ios/MmkvModule.mm Lines 49 to 57 in 6fa83b5
|
of course. If the app groups were not correctly set up, there would be no case where I can share values between the app and the extension. It indeed works, but the issue here is that, it is not readable by the 'other side' until that app is restarted. hope that makes sense.. I'm going to try modifying the library such that the initialization code re-runs when the app state goes background -> foreground. If this fixes the issue then it would confirm my suspicion that there is some dependency on that code running in order for the values to be updated on the other side. |
Okay so the MMKV instance gets created with AppGroups... idk |
I can confirm I started having issues with data being stale in my ios extension. Have been using AppGroups with MultiProcess mode for 6+months without any issue. Recently upgraded to Expo 50 & RN 0.73, not sure if that's linked, but now my extension often reads stale data, and sometimes logs There seems to be recent iOS multiprocess PRs on the MMKV repo but I tried pinning the MMKV version to the latest 1.3.2 and no luck EDIT : looking more closely, it seems that
So right now iOS devs might want to wait for the next release or pin the MMKV iOS version to 1.3.1. I guess my issues are not due to Expo 50 / RN upgrade but to the fact that I upgraded many libs during that big upgrade and might have upgraded MMKV at the same time. |
I'm using this to share data between a share extension and a react native app and noticing an issues that is pretty easily reproducible.
Observed behavior (when react native app is closed):
set('key','value')
on extensionget('key')
, returns 'value' (works as expected).Observed behavior (when app is backgrounded):
set('key','value')
on extensionget('key')
, returns undefined (unexpected).get('key')
now returns 'value'So the value is indeed being written correctly to the shared container, however the app can only read it after a restart, which leads me to believe that the initialization code is a requirement in order to get the right value.
The text was updated successfully, but these errors were encountered: