• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to defer NSDocument:writeToFile:ofType ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: How to defer NSDocument:writeToFile:ofType ?
      • From: "Erik M. Buck" <email@hidden>
References: 
 >Re: How to defer NSDocument:writeToFile:ofType ? (From: "Erik M. Buck" <email@hidden>)

  • Prev by Date: Re: Nib owner's outlets
  • Next by Date: Re: How viable is Cocoa development?
  • Previous by thread: Re: How to defer NSDocument:writeToFile:ofType ?
  • Next by thread: Re: How to defer NSDocument:writeToFile:ofType ?
  • Index(es):
    • Date
    • Thread