You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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?
The text was updated successfully, but these errors were encountered:
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.
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:
NSFileCoordinator
wrapper be sufficient or should one app notify the other app (e.g. via distributed objects) saying that "I'm saving – hands off".refreshObject: mergeChanges:
or do a re-fetch for just anything that's shown onscreen)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?
The text was updated successfully, but these errors were encountered: