New Autosave behavior and NSDocument initializers
New Autosave behavior and NSDocument initializers
- Subject: New Autosave behavior and NSDocument initializers
- From: Kyle Sluder <email@hidden>
- Date: Tue, 30 Aug 2011 10:56:09 -0700
Hi all,
Our applications support creating new documents from templates. The
current way we do this is to trap attempts to open files of our
template type in -application:openFile:, call the standard
NSDocumentController path as if we were opening that file, but then
send the resulting NSDocument a -becomeUntitledWithType: message that
does the following:
- (void)becomeUntitledWithType:(NSString *)docType {
[self setFileURL:nil];
[self setDisplayName:nil];
[self setFileType:docType];
[self setAutosavedContentsFileURL:nil];
[self setDisplayName:nil];
}
I was wondering if this is still sufficient to mimic the creation of a
fresh new document given the new autosave behavior on 10.7, or if
there is more bookkeeping (perhaps on the NSDocumentController side of
things) that I need to take care to reset.
I've been studying the new file saving and loading path: http://db.tt/9yzEKle
The thought had crossed my mind that I'd need to replicate its work in
order to support templates. But it doesn't look like that's
necessarily required, though I'll probably not be able to return YES
from +canConcurrentlyReadDocumentsOfType: when passed my template file
type.
Is there anything I'm missing?
--Kyle Sluder
_______________________________________________
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