Skip navigation.
 
mlNSFileHandle / NSConcreteFileHandle problem
FROM : Jeff LaMarche
DATE : Sun Mar 30 21:30:11 2008

I'm having an unusual problem with an NSFileHandle. I'm creating an 
NSFileHandle and initializing it with a file descriptor that's 
actually a network socket. I'm able to send and receive data using it 
and it works fine. Then, I pass the NSFileHandle instance as the first 
argument of an NSInvocation call

[invocation setArgument:fh atIndex:2];

When I invoke the invocation, it calls my method with the file handle 
as the first argument, exactly as it's supposed to, BUT, the file 
handle doesn't work. I get the following message in the console when 
my code tries to actually use it:

*** +[NSConcreteFileHandle writeData:]: unrecognized selector sent to 
class 0xa014ba80

The weird thing is, if I call:

[invocation target] performSelector:[invocation selector] 
withObject:fh];

it works just fine.

Does anyone have any idea what might be going on here? I've tried 
creating a new NSFileHandle and initializing it with the descriptor 
taken from the first argument, and I get the same result doing that. 
I'm able to work around the problem, but I'd still like to know if I'm 
doing something wrong.

TIA for any help anyone can offer.
Jeff

Related mailsAuthorDate
mlNSFileHandle / NSConcreteFileHandle problem Jeff LaMarche Mar 30, 21:30
mlRe: NSFileHandle / NSConcreteFileHandle problem Jeff LaMarche Mar 30, 21:33
mlRe: NSFileHandle / NSConcreteFileHandle problem Boaz Stuller Mar 30, 22:48