Questions tagged [nsdocument]

NSDocument is an abstract class that defines the interface for documents, objects that can internally represent data displayed in windows and that can read data from and write data to files.

NSDocument is an abstract class that defines the interface for documents, objects that can internally represent data displayed in windows and that can read data from and write data to files. Documents create and manage one or more window controllers and are in turn managed by a document controller. Documents respond to first-responder action messages to save, revert, and print their data.

Conceptually, a document is a container for a body of information identified by a name under which it is stored in a disk file. In this sense, however, the document is not the same as the file but is an object in memory that owns and manages the document data. In the context of the Application Kit, a document is an instance of a custom NSDocument subclass that knows how to represent internally, in one or more formats, persistent data that is displayed in windows.

A document can read that data from a file and write it to a file. It is also the first-responder target for many menu commands related to documents, such as Save, Revert, and Print. A document manages its window’s edited status and is set up to perform undo and redo operations. When a window is closing, the document is asked before the window delegate to approve the closing.

NSDocument is one of the triad of AppKit classes that establish an architectural basis for document-based applications (the others being NSDocumentController and NSWindowController).

References:

NSDocument Class Reference

479 questions
0
votes
1 answer

When can I access the data of my NSDocument during the initialization?

I need to instantiate some properties with the content of the saved document. Since theses properties are used by my interface, I would like to instantiate them before the NIB is loaded. At which point of my initialization can I access the data of…
Colas
  • 3,473
  • 4
  • 29
  • 68
0
votes
1 answer

Back Up Documents Folder to iCloud

My app builds PDFs unique to each individual. Since they cannot be easily recreated, and would need to be used on multiple devices, I want them to be backed up to be iCloud. The ideal situation would be that they are made on one device, and when…
user717452
  • 33
  • 14
  • 73
  • 149
0
votes
2 answers

Document based OSX app - Limit number of open documents to one

I'm trying to figure out how to limit my NSDocument based application to one open document at a time. It is quickly becoming a mess. Has anyone been able to do this in a straightforward & reliable way? ////EDIT//// I would like to be able to…
olynoise
  • 2,016
  • 2
  • 19
  • 32
0
votes
0 answers

Access/Use iCloud Data of existing iOS App from a Mac OS App

I am working an Mac OS version of an existing iOS App. The iOS App uses iCloud to share its data accross devices. Of course this data should be accessable from the Mac OS version as well. When implementing the iCloud functionality in the iOS App…
Andrei Herford
  • 17,570
  • 19
  • 91
  • 225
0
votes
1 answer

Use of NSDocument when I don't need multiple document support?

I like NSDocument because, when used in conjunction with a Core Data model, gives me an application with persistent data for free. But I know that, for my particular project, I will only ever deal with one "document." I don't need the multiple…
Dany Joumaa
  • 2,030
  • 6
  • 30
  • 45
0
votes
2 answers

Cache for packaged NSDocument file format design

I am designing a packaged-based NSDocument file format. The document will contain lots of directories and files, so I want to save a cache, either as part of the document, or in the application's Caches directory. The cache would be a simple plist…
Dejal
  • 813
  • 6
  • 18
0
votes
1 answer

OS X Data file editor saving to XML: Document based or not?

So I'm trying to make a data editor for an iOS/Android app I've got. There's 3 separate data files that I'd like to be able to edit, and I would like to save them to plist files or xml files. I'm planning on using Core Data in the app. The problems…
s73v3r
  • 1,751
  • 2
  • 22
  • 48
0
votes
1 answer

NSDocument Saving audio And Vidoes Files

I have an ios App That has Download Feature for Audio and Video Files The Question Is Where Should I Download These Files And How ?
0
votes
1 answer

NSDocument display name of page with WebKit

I'm trying to get WebKit to display the page title of the currently opened document window, which includes a WebView. The document won't display after I run the app. I'm using Document.m and windowNibName to achieve this, but I'm sure what I'm doing…
user893246
0
votes
2 answers

Cocoa - Adding menu to support versions? (Like in TextEdit)

In TextEdit, if you click the little dropdown next to the filename you get a menu which shows a couple of entries including Rename, Move to iCloud, Move To, Duplicate, Lock and finally Browse All Versions. I'm wondering how to support this menu? On…
Kyle
  • 17,317
  • 32
  • 140
  • 246
0
votes
1 answer

Link NSDocument's changeCount to NSTextView

Is there a way to somehow link an NSDocument's changeCount to the only NSTextView that is used for a document? Or so I have to implement all the necessary NSTextViewDelegate methods and update the changeCount myself?
Jawap
  • 2,463
  • 3
  • 28
  • 46
0
votes
2 answers

NSUserDefaults per document

Does the AppKit framework provide a way to store NSUserDefaults per NSDocument? If not, how would you recommend to implement this?
hpique
  • 119,096
  • 131
  • 338
  • 476
0
votes
0 answers

Load default database in CoreData document based application

I have an application based on the documents and I would like that when you create a new file the tableview are pre-populated with default data. I did the following: I launched my application and I populated the tables, then I saved the file…
Andrea
  • 427
  • 3
  • 16
0
votes
3 answers

Validate before opening a document in NSDocument architecture

I have an document based application which formats an XML file. Writing and reading of document is done in my NSDocument subclass - (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError -…
Rajesh
0
votes
1 answer

NSDocument won't open

I am making my first IOS application and using JSON and core data for getting and storing my data. But for some reason or another it won't open it's NSDocument. This is what I am doing. - (void)useDocument { if (![[NSFileManager defaultManager]…
Steaphann
  • 2,797
  • 6
  • 50
  • 109
1 2 3
31
32