Re: returning NO from readFromFile:ofType: causes exception
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