nsdocument

How to put a Property List in the Documents folder of my app when app is shipped?

落花浮王杯 提交于 2019-12-25 00:08:19
问题 I have several tableviews in my app and the data source for each tableview is a property list. Currently I have the propertylists saved in the application bundle. However, thats only because I created them in XCode and they are automatically saved in the documents folder. This is fine as when the app ships, thats where they need to be. However, I would like to put a copy of the property lists in the documents folder of my app as well when it ships. How can I do that? I mean Can I program

How does NSDocumentController slot into my document based app?

拜拜、爱过 提交于 2019-12-22 07:05:18
问题 I'm building my first serious Cocoa app. It is a document based app using Core Data for persistent storage. Using the Xcode "New project" template options, my project started with a couple of default classes: MainMenu.xib (the main menu of my app) EventDocument.xib (the main window of my app) EventDocument.h and EventDocument.m (the persistent document class) I took the design from there and it all works rather nicely, however through another question I came across a Cocoa class

Cocoa NSDocument: getting autosave to work

馋奶兔 提交于 2019-12-22 06:37:04
问题 Documentation simply states that setting setAutosavingDelay to anything > 0 on the shared doc controller should do it, but after calling [[NSDocumentController sharedDocumentController] setAutosavingDelay:2.0]; in my controller, autosave doesn't seem to work: I neither see anything in ~/Library/Autosave Information/ , nor is [[[NSDocumentController sharedDocumentController] currentDocument] autosavedContentsFileURL] initialized. Note that in my app, normal loading and saving work fine

Recipe for making Cocoa NSDocument packages play well with svn?

本秂侑毒 提交于 2019-12-22 01:13:14
问题 I have a tool that writes package-style documents. It's implemented using NSDocument and overrides the following NSDocument methods: - (NSFileWrapper *)fileWrapperOfType:(NSString *)typeName error:(NSError **)outError; - (BOOL)readFromFileWrapper:(NSFileWrapper *)fileWrapper ofType:(NSString *)typeName error:(NSError **)outError; This is all lovely, except when I save a document that's under version control. (The .svn directories aren't preserved, etc.) Is there a good recipe somewhere for

How to implement a complex NSDocument-based app that imports and exports non-native file types?

孤街醉人 提交于 2019-12-21 20:49:40
问题 I'm working on an app that supports a very complicated set of operations. It's akin to something like Xcode, in that the main document is represented by something like a project window, with numerous entries in it. The document on disk is a bundle (meaning a directory with a file & folder structure underneath). There is at least one file type that it can import and export ( .mfst), but it's not intended to directly edit this file type. That is, opening this file type results in a native

Document-based application, or not?

戏子无情 提交于 2019-12-21 05:14:13
问题 I'm writing a desktop app that could be used to manage a dance academy. My Core Data model contains such entities as Student, Teacher, Class, Invoice, etc along with the various relationships between them. My planned UI consists of a vertical split view with an iTunes-like OutlineView on the left hand-side. When you click on the "Students" item in that outline view, the contents of the right-hand panel get swapped in from the ManageStudents NIB. Likewise, if you click on the "Invoices" item

NSDocument to hold a complete folder?

给你一囗甜甜゛ 提交于 2019-12-20 09:44:47
问题 I ask sorry if this argument has already been covered, but after some research i found nothing precise. I need to make a document based application, where the document is actually not a single file but a structured collection of files, in a directory. The windows will show a pdf contained in the folder, with a specific filename, and enrich it with informations from the other files in the folder. I cannot use pdf annotations to achieve this, i really need to keep the files separated from the

Include iCloud on save dialog box in mac app

早过忘川 提交于 2019-12-20 03:48:06
问题 I have implemented the iCloud support on my Mac document-based app. NSDocument subclass can handle open e save file on local storage and iCloud . But, I can upload my files on iCloud only dragging it on the Open-New File Panel. When the app prompt the user the location to save the file, iCloud is not on the list. Isn't it supported by default like in TextEdit? I have to implement with my own code? Image here: 回答1: I managed to fix this problem by recreating certificates and provisioning

How to Sync an NSDocument from iPad/iPhone to Mac osx with iCloud

坚强是说给别人听的谎言 提交于 2019-12-13 02:36:26
问题 How to Sync an nsdocument from ipad/iphone to Mac osx with icloud I managed to get it working! from Mac osx to iPhone/iPad but not from iPad/iPhone to Mac osx Here's my code from the subclassed nsdocument file on osx: Header file: #import <Cocoa/Cocoa.h> #import <Foundation/Foundation.h> @interface subclassedNSDocument : NSDocument @property (strong) NSData *myData; @end Implementation file: - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError { BOOL

Why is my dataOfType: not called when saving?

给你一囗甜甜゛ 提交于 2019-12-11 18:48:06
问题 I have an NSDocument that contains a dataOfType method, but it is not called when I do a save. - (NSData *)dataOfType:(NSString *)typeName error:(NSError *__autoreleasing *)outError { NSLog(@"db: %@", db); return [NSKeyedArchiver archivedDataWithRootObject:db]; } Why is this not called? Specifically, are there any reasons why my current document should not be the first responder that the menu-item "Save" points to? 回答1: Did you leave 'Use Core Data' checkbox unchecked on create new project