A good approach for storing the database in a shared AppGroup container

I am using Realm in my application as a database and I have a sharing extension to support multimedia to be shared with another application. Since I need my database to be accessed from the share extension, I moved the realm file from the application document directory to the shared Appgroup container. I have some questions.

  • Is it safe to store the database in the shared container space.
  • When I remove the app, the files inside the shared container are saved, so when the shared container is removed.
  • Any other advice on handling my script.
+3


source to share


1 answer


It looks like you have cross-posted this on the Realm GitHub issue tracker. My comment from https://github.com/realm/realm-cocoa/issues/4899#issuecomment-297121059 was posted here for your convenience:

  •   
  • Is it safe to store the database in the shared container space.  

Yes. This is actually the only way to share files between processes on iOS.

  1.   
  2. When I remove the app, the files inside the shared container are saved, so when the shared container is removed.  

According to fooobar.com/questions/381421 / ... , iOS removes shared containers as soon as the last app has access to it is removed from the device.

If you find situations where this does not happen, I recommend that you file a radar to report the bug to Apple. https://bugreport.apple.com

  1.   
  2. Any other advice on handling my script.  

It looks like you are doing everything right. Keep it up! 👌




In the future, please do not cross-post questions on StackOverflow with the tag realm

as well as the Realm GitHub repos. Realm's engineering team controls both of these channels, so your question will be answered even if you just post it once.

+3


source







All Articles