• 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
NSError in NSDocument readFromURL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSError in NSDocument readFromURL


  • Subject: NSError in NSDocument readFromURL
  • From: Konrad Windszus <email@hidden>
  • Date: Mon, 13 Jul 2009 00:50:32 +0200

If I set an NSError in the method readFromURL of my NSDocument, I am not able to overwrite the NSLocalizedDescriptionKey.
If have the following code in that method:


- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError
{
NSArray *objArray = [NSArray arrayWithObjects:@"Description", @"FailureReason", @"RecoverySuggestion", nil];
NSArray *keyArray = [NSArray arrayWithObjects:NSLocalizedDescriptionKey, NSLocalizedFailureReasonErrorKey, NSLocalizedRecoverySuggestionErrorKey, nil];
NSDictionary *eDict = [NSDictionary dictionaryWithObjects:objArray forKeys:keyArray];

// fill outError
*outError = [NSError errorWithDomain:@"myDomain" code:1 userInfo:eDict];
return NO;
}


Unfortunately only the strings of the keys NSLocalizedFailureReasonErrorKey and NSLocalizedRecoverySuggestionErrorKey are displayed together with a standard error text. My own localizedDescription ("Description") is not displayed. Instead I got the standard error text "The document <xyz> could not be opened. FailureReason RecoverySuggestion". Is this a bug, that the string with the key NSLocalizedDescriptionKey is always overwritten before displayed or not displayed at all, if set in readFromURL or is this feature somewhere documented? I could not find anything regarding this at apple.

Thanks for any help
Konrad

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSError in NSDocument readFromURL
      • From: Chris Miner <email@hidden>
    • Re: NSError in NSDocument readFromURL
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Best 'Cocoa' File Preview
  • Next by Date: Re: Best 'Cocoa' File Preview
  • Previous by thread: Re: CAKeyframeAnimation problem
  • Next by thread: Re: NSError in NSDocument readFromURL
  • Index(es):
    • Date
    • Thread