• 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: reason for getting NSFileHandle:writeData exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: reason for getting NSFileHandle:writeData exception
      • From: Chris Heimark <email@hidden>
References: 
 >reason for getting NSFileHandle:writeData exception (From: Chris Heimark <email@hidden>)

  • Prev by Date: reason for getting NSFileHandle:writeData exception
  • Next by Date: Re: How to support an Application with International languages.
  • Previous by thread: reason for getting NSFileHandle:writeData exception
  • Next by thread: Re: reason for getting NSFileHandle:writeData exception
  • Index(es):
    • Date
    • Thread