Re: How to defer NSDocument:writeToFile:ofType ?
Re: How to defer NSDocument:writeToFile:ofType ?
- Subject: Re: How to defer NSDocument:writeToFile:ofType ?
- From: Manfred Lippert <email@hidden>
- Date: Fri, 25 Jan 2002 23:15:34 +0100
>
Try overriding
>
saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:
Hmm, it generally works great, but I have a little problem with it in a
specific case:
I override saveToFile and begin my sheet. If the sheets finshes, I call the
overidden [super saveToFile]. Normally this works great, but it does NOT
work, if the app is in a "quitting state":
I have an unsaved document and I try to quit my app. It asks me to save the
document. I click "Save...". The Save Panel appears. After that my
saveToFile method is called and my sheet appears. After that, I call the
original [super saveToFile] method and in there my app crashes. :-(
What can that be? Any hints? How can I fix that?
The calls on the stack are:
- [NSDocumentController _closeDocumentsStartingWith: ...] <- CRASH
- [NSDocument _finishSaveDocumentTo: ...]
- [NSDocument saveToFile: ... ] <- called from my source
----------
Another problem: How can a call a selector (SEL) on an object?
To be more specific: If the user clicks "Cancel" in my sheet, then I must
_not_ call [super saveToFile] but I have to perform the didSaveSelector to
get the application back in the right state. I cannot figure out, how to
call it. The documentation says:
didSaveSelector should have the following signature:
- (void)document:(NSDocument *)doc didSave:(BOOL)didSave contextInfo:(void
*)contextInfo
How do I call such a selector on a given object?
Regards,
Mani