Skip to content
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

feat: Support AppGroups #705

Merged
merged 6 commits into from
Jul 22, 2024
Merged

feat: Support AppGroups #705

merged 6 commits into from
Jul 22, 2024

Conversation

mrousavy
Copy link
Owner

Adds support for using AppGroups.

This stores MMKV instances in a shared AppGroup directory - it is mostly automatic.

To do this simply add your AppGroup to Info.plist, and don't pass a path to new MMKV(...) - MMKV will then automatically use the AppGroup path instead.

Related issues

Related PRs

Sorry @calism2 - your PR looked good, but I felt like moving the iOS-specific code into MmkvPlatformContext made more sense instead of cramming it into the shared cpp constructor.

@mrousavy mrousavy merged commit 5a63632 into main Jul 22, 2024
8 checks passed
@calism2
Copy link

calism2 commented Jul 22, 2024

It's not a problem that my original PR wasn't merged. The new approach is more readable and has better error handling. I tested both scenarios, and they work perfectly. I've added screenshots as well. Thank you for the quick PR merge.

With app group setup.
Screenshot 2024-07-22 at 21 00 53

Without app group setup.
Screenshot 2024-07-22 at 21 00 53

@mrousavy
Copy link
Owner Author

Thank you for testing @calism2!

But when do you see this error? Did you set AppGroup to something that is not a valid path?

@calism2
Copy link

calism2 commented Jul 22, 2024

Yes, the AppGroup needs to be added through Capabilities (you can add it for all, debug, or release), similar to Apple Pay. If you disable or remove the capability, the path won't be discoverable. As shown in the image, this setup only works for the debug version; you'll encounter an error in the release version. I tested this by removing the AppGroup capability from debug version.

Screenshot 2024-07-22 at 21 35 04

@mrousavy
Copy link
Owner Author

gotcha - great!

@coopermaruyama
Copy link

nice! thanks for the contributions 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants