2

I am writing a document based application, where there is a project file that the user opens, and a number of associated source files, all of which I wish to edit in the same window. How can I do this within the NSDocument architecture? specifically how can create multiple NSDocuments as children of the NSDocument associated to the project file, and then display these all within one window controller.

This has been asked before (e.g. Multiple Documents in a Single Window in Cocoa), but the answers suggest working outside of the document architecture, something no longer possible with the recent App Store rule change that requires all applications to use the sandbox, which requires all IO via NSDocument.

Community
  • 1
  • 1
Duncan
  • 443
  • 1
  • 5
  • 12
  • I don't understand why you can't work outside of the document architecture; how is an `NSDocument` sandboxed and other I/O not? You're going to have to work outside the document architecture as it doesn't support what you want (i.e. it supports one document with one-or-many windows). – trojanfoe Feb 02 '12 at 07:38
  • 3
    Under the soon-to-be-enforced sandboxing system, when a document is opened in your app, the kernel adds it to a whitelist of files or directories which your app can access. Any file or directory not in this whitelist cannot be accessed, regardless of the UNIX file permissions. An `NSDocument` is not needed to add something to the whitelist, but it is the only way (that I know of) to persist this entry in the whitelist over to the next time the app is launched (apps are expected to re-open documents). I'm not sure if there is some other way to do this, seems like there should be. – Abhi Beckert Feb 05 '12 at 18:48

1 Answers1

1

Over on the question you linked, I just added a new answer: Multiple Documents in a Single Window in Cocoa

My idea is a system where you have a single document per window, but that window is a borderless child of some other window, which will position/resize/hide the actual document window at will, and link the child window's view into the responder chain.

I haven't done it, but plan to. I think it will work better than any of the other techniques I've seen.

Community
  • 1
  • 1
Abhi Beckert
  • 32,787
  • 12
  • 83
  • 110