odd behavior with NSError?
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