*** -[NSConcreteFileHandle availableData]: Invalid argument
*** -[NSConcreteFileHandle availableData]: Invalid argument
- Subject: *** -[NSConcreteFileHandle availableData]: Invalid argument
- From: Jeff LaMarche <email@hidden>
- Date: Wed, 9 Apr 2008 14:53:43 -0400
I'm periodically getting this message
*** -[NSConcreteFileHandle availableData]: Invalid argument
printed to the console of an application I'm working on. I'm confused
about what it means because availableData doesn't take an argument.
Here's what I'm doing: I'm using NSFileHandle to handle socket
communications with a remote server. I create an old-fashioned network
socket, allocate an NSFileHandle, feed it the socket using
initWithFileDescriptor:, and then use readInBackgroundAndNotify after
specifying to receive NSFileHandleReadCompletionNotifications. The
odd thing is that despite this error getting printed in the console,
my code is working as expected - I am getting data from the file
handle and the data appears to be 100% correct.
My call back method looks like this:
- (void)updateStatusCallback:(id) notification
{
NSFileHandle *fh = [notification object];
NSData *data = [fh availableData]; // <----- This call generates
the message in the console sometimes... but it works
NSString *theString = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
// code to process the response
}
In the debugger, I see no difference in fh between calls that generate
the message and those that don't - it's always an NSConcreteFileHandle
with a positive file descriptor. This message show up rougly about 10%
of the time that the callback gets called, although it's not consistent.
Thanks in advance!
Jeff
_______________________________________________
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