Re: reason for getting NSFileHandle:writeData exception
Re: reason for getting NSFileHandle:writeData exception
- Subject: Re: reason for getting NSFileHandle:writeData exception
- From: Chris Heimark <email@hidden>
- Date: Tue, 10 Jul 2007 00:57:10 -0400
Sure seems like I have a trashed "outputFileHandle", doesn't it?
Well, here is how I was creating the handle:
outputFileHandle = [NSFileHandle fileHandleForWritingAtPath:
[savePanel filename]];
Then I tried a little bit of retention to keep it around!
outputFileHandle = [[NSFileHandle fileHandleForWritingAtPath:
[savePanel filename]] retain];
And what do you know? IT WORKS NOW!!!
Perhaps you can provide some insight as to when retain/release is
needed?
On Jul 9, 2007, at 8:15 PM, Brian Stern wrote:
And here is the code that runs in an NSTask callback occurring as
a result of running an external command line program and trying to
absorb the binary results using an NSData object.
>>>>>
[outputFileHandle writeData:rngData];
The exception indicates that the code is trying to send the
writeData message to an NSString. So outputFileHandle is an
NSString, not a file handle. Perhaps you're not retaining the file
handle correctly or you're accessing it from multiple threads
incorrectly.
--
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