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

Sharing documents across processes? #31

Open
adib opened this issue Nov 24, 2014 · 0 comments
Open

Sharing documents across processes? #31

adib opened this issue Nov 24, 2014 · 0 comments

Comments

@adib
Copy link
Contributor

adib commented Nov 24, 2014

Just wondering is it workable to share a document and have it open in multiple processes? The reason I'm asking is in the context of App Extensions. One of Apple's prescribed way for an extension to communicate with its containing app is through shared storage and they specifically mention Core Data as one option.

Extensions

When you set up a shared container, the containing app—and each contained app extension that you allow to participate in data sharing—have read and write access to the shared container. To avoid data corruption, you must synchronize data accesses. Use Core Data, SQLite, or Posix locks to help coordinate data access in a shared container.

With respect to the above snippet, I'm just wondering whether it is a good option to have one shared document open by both the app and its extension. There's a good chance of both of them be running at the same time. What are the caveats in doing so?

From the top of my mind these may come into play:

  • File coordination – will the NSFileCoordinator wrapper be sufficient or should one app notify the other app (e.g. via distributed objects) saying that "I'm saving – hands off".
  • Refreshing objects (e.g. calling refreshObject: mergeChanges: or do a re-fetch for just anything that's shown onscreen)
  • Telling NSDocument to update its notion of the file's on-disk modification date (otherwise this invokes the dreaded "file is modified by another application..." error box).

Anything else that I'm missing?

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

No branches or pull requests

1 participant