• 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: returning NO from readFromFile:ofType: causes exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: returning NO from readFromFile:ofType: causes exception


  • Subject: Re: returning NO from readFromFile:ofType: causes exception
  • From: Robert Clair <email@hidden>
  • Date: Fri, 18 Feb 2005 17:32:51 -0500

Sorry to reply to my own post, but a bit more information:

my document subclass overrides initWithContentsOfFile:ofType:  -


- (id)initWithContentsOfFile:(NSString *)fileName ofType:(NSString *)docType
{
[super initWithContentsOfFile: fileName ofType: docType];


  if (self )
    {
         // custom stuff
    }
  return self;
}


The call to super

    [super initWithContentsOfFile: fileName ofType: docType];

is what calls    readFromFile:ofType:

Looking in the debugger, the call to super returns a non-nil self even if
readFromFile:ofType: has returned NO.


It seems as if this is a bug. Setting self to nil with the debugger and letting
things continue gives a happier result of no exceptions and brings
up the warning panel that the file didn't load. (Well, not that happy - there
ought to be a way to suppress the panel, it's a bit redundant and un-aesthetic
if the reason it didn't load is that the user just canceled it.)


Perhaps this is why Pages lets a file with missing fonts come all the way up
and then gives you a chance to close it, rather than warning you at the
beginning and giving you a chance to abort the reading ??


....Bob Clair



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: returning NO from readFromFile:ofType: causes exception
      • From: Clark Cox <email@hidden>
    • Re: returning NO from readFromFile:ofType: causes exception
      • From: Frank Midgley <email@hidden>
References: 
 >returning NO from readFromFile:ofType: causes exception (From: Robert Clair <email@hidden>)

  • Prev by Date: Re: Learn Bindings Materials?
  • Next by Date: NSApplication Bug or Feature: Keystroking -performClose closes all windows?
  • Previous by thread: returning NO from readFromFile:ofType: causes exception
  • Next by thread: Re: returning NO from readFromFile:ofType: causes exception
  • Index(es):
    • Date
    • Thread