• 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: "No document could be created." panel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "No document could be created." panel


  • Subject: Re: "No document could be created." panel
  • From: Kaspar Fischer <email@hidden>
  • Date: Tue, 14 Feb 2006 10:13:05 +0100

On 14.02.2006, at 05:56, Dave Rosborough wrote:
Hey all,

I've got a custom NSDocumentController subclass that checks to see if my app's trial period has expired before creating a new document. I've overridden:

- (id)openUntitledDocumentAndDisplay:(BOOL)displayDocument error: (NSError **)outError
- (id)openDocumentWithContentsOfURL:(NSURL *)absoluteURL display: (BOOL)displayDocument error:(NSError **)outError


and the other associated (now deprecated) methods, returning nil if the trial has expired.

My problem is that some object, somewhere, is throwing up an NSPanel with the message "No document could be created.". Does anyone know how to get that to disappear? I really want it to fail silently, or at least use an NSPanel of my choosing.

I am doing something similar, but with the new, non-deprecated methods

  -initWithContentsOfURL:ofType:error:

  // Note: The following method is called only when a new document
  // is created (and not when an existing one is opened.)
  - (id)initWithType:error:

of class NSDocument.  Here is my code:

- (id)initWithContentsOfURL:(NSURL *)absoluteURL
ofType:(NSString *)typeName
error:(NSError **)outError
{
id result = [super initWithContentsOfURL:absoluteURL
ofType:typeName
error:outError];
if (/* error */) {
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:@"blabla",
NSLocalizedDescriptionKey,
@"The document could not be opened.", NSLocalizedFailureReasonErrorKey, nil];
*outError = [[NSError errorWithDomain:/* some error domain name */
code:/* some number */
userInfo:userInfo] retain];
return nil;
}
return result;
}


Regards,
Kaspar
_______________________________________________
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


References: 
 >"No document could be created." panel (From: Dave Rosborough <email@hidden>)

  • Prev by Date: XMLDocument NSData
  • Next by Date: Re: why does this leak?
  • Previous by thread: "No document could be created." panel
  • Next by thread: (no subject)
  • Index(es):
    • Date
    • Thread