Bunch of CoreData based NSDocument questions.
Bunch of CoreData based NSDocument questions.
- Subject: Bunch of CoreData based NSDocument questions.
- From: Motti Shneor <email@hidden>
- Date: Sun, 22 Nov 2015 21:44:49 +0200
Hi Everyone.
I develop a Docuent-based Mac application for scientific use, using the BSManagedDocument open-source, which provides many of the modern behaviors of UIManagedDocument on Mac (whereas NSPersistentDocument has been neglected for ages). Mainly what I wanted from BSManagedDocument was its support for document packaging, To allow adding external records to my CoreData entities.
I have a few problems, but I can't find my way in th documentation of the document architecture. Please bare with me if these questions are novice's questions.
1. My app supports autosave in-place. This means each "save" practically recreates the whole document as temporary file, then replaces the document with the new one. Such behavior is reasonable for a relatively small document -not for my ever growing databases who easily reach 250MB. What is the point in using SQL persistence, with all its glorious transactions, and rollbacks, if CoreData persistence isn't used at all for autosaving? Saves will get slower and slower as document becomes bigger and bigger, not to mention the size of document-versions, and although BSManagedDocument saves in the background - this seems really awkward. Is there a better solution?
2. I must still support user explicit "Save" commands, because I allow auto-saving temporary invalid states of my model, and only validate and confirm integrity upon "real" saves. For that, I want to force the user to Save/Revert/Cancel changes when he closes the document, or quits the application.
When closing the document's main window - all is well. My window-controller overrides get called, user is presented with a dialog, etc. But when the user chooses to Quit the application - it quits immediately, and never calls any of the NSDocumentWindowController overrides - because my document is autosaved. The application doesn't care at all that the document is "dirty". I know of the ApplicationShouldQuit app-delegate call, but I do not want to interfere with the Document architecture - I believe there must be a point to introduce my document-closing logic. But where?
There's more, but I'll wait for some answers first...
Motti Shneor.
-- ceterum censeo microsoftiem delendam esse ---
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden