Re: reason for getting NSFileHandle:writeData exception
Re: reason for getting NSFileHandle:writeData exception
- Subject: Re: reason for getting NSFileHandle:writeData exception
- From: Brian Stern <email@hidden>
- Date: Mon, 9 Jul 2007 16:55:33 -0400
On Jul 9, 2007, at 4:23 PM, Chris Heimark wrote:
I am getting a nasty little exception:
2007-07-09 16:18:41.294 DisplayData[4441] *** -[NSCFString bytes]:
selector not recognized [self = 0x2e02c]
In response to the following snippet of code:
[outputFileHandle writeData:@"Please stop biting me!\r"];
writeData takes an NSData* not an NSString*. The exception is
because NSString doesn't have a method named bytes.
If you really want to write strings to the file handle use NSString's
dataUsingEncoding method to convert the NSString to an NSData object,
or some other method to add your string to an NSData object.
--
Brian Stern
email@hidden
_______________________________________________
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