ammarahm-ed / react-native-mmkv-storage

An ultra fast (0.0002s read/write), small & encrypted mobile key-value storage framework for React Native written in C++ using JSI
https://rnmmkv.now.sh
MIT License
1.59k stars 111 forks source link

Multiprocess not working [Bug] #284

Open IZSkiSurfer opened 2 years ago

IZSkiSurfer commented 2 years ago

Describe the bug If Multiprocessing is enabled the app crashes on iOS. I think there got something lost while you refactored the library in several steps. Or is it just the documentation missing an important bit?!

To Reproduce add MMKV = MMKV.setProcessingMode(ProcessingModes.MULTI_PROCESS)

Expected behavior Multiprocess should work

Platform Information:

Additional context <libMMKV.mm:180::+[MMKV mmkvWithID:cryptKey:rootPath:mode:]> Getting a multi-process MMKV [settings] without setting groupDir makes no sense

ammarahm-ed commented 2 years ago

@IZSkiSurfer Multi process works. See https://github.com/ammarahm-ed/react-native-mmkv-storage/issues/131

It's useful when you want to share same storage instance between Share Extension & App.

IZSkiSurfer commented 2 years ago

According to your documentation you simply call MMKV.setProcessingMode(ProcessingModes.MULTI_PROCESS) [https://rnmmkv.vercel.app/#/loaderclass?id=setprocessingmode] But if I do so I get that error message. Somehow I need to set that groupDir but I don't find any hint in the documentation nor any way in the current sourcecode to set it - at least not from within the react-native code. The issue #131 is kinda old and references an older version I guess.

ammarahm-ed commented 2 years ago

The solution there applies to the latest version. Check the comments.