• 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
odd behavior with NSError?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

odd behavior with NSError?


  • Subject: odd behavior with NSError?
  • From: Colin Howarth <email@hidden>
  • Date: Fri, 2 Oct 2009 05:31:32 +0200

Hi,

I'm trying to read a file using this code, which is failing:


NSStringEncoding *enc;
NSError *error;

NSString *file = [NSString stringWithContentsOfFile:@"/Users/colin/ developer/Trace/glass.csv" usedEncoding:enc error:&error];

NSLog(@"%i: %@", [error code], [error userInfo]);



The log shows:


2009-10-02 05:23:16.788 Trace[40156:a0f] 264: { NSFilePath = "/Users/colin/developer/Trace/glass.csv"; }


Only when I do

(gdb) po error

do I get


Error Domain=NSCocoaErrorDomain Code=264 UserInfo=0x2000506e0 "The file “glass” couldn’t be opened because the text encoding of its contents can’t be determined."



which is much more helpful!


Why is my NSLog statement being so unhelpful???


--colin_______________________________________________

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: odd behavior with NSError?
      • From: "Stephen J. Butler" <email@hidden>
    • Re: odd behavior with NSError?
      • From: Quincey Morris <email@hidden>
    • Re: odd behavior with NSError?
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: converting a NSView into an NSImage, when scaling via scaleUnitSquareToSize ...
  • Next by Date: Re: odd behavior with NSError?
  • Previous by thread: converting a NSView into an NSImage, when scaling via scaleUnitSquareToSize ...
  • Next by thread: Re: odd behavior with NSError?
  • Index(es):
    • Date
    • Thread