Re: reason for getting NSFileHandle:writeData exception
Re: reason for getting NSFileHandle:writeData exception
- Subject: Re: reason for getting NSFileHandle:writeData exception
- From: Andrew Farmer <email@hidden>
- Date: Mon, 9 Jul 2007 22:09:32 -0700
On 09 Jul 07, at 21:57, Chris Heimark wrote:
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?
Read this:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/
Tasks/MemoryManagementRules.html
The selector 'fileHandleForWritingAtPath' doesn't contain the words
'alloc', 'new', or 'copy', so the object it returns is autoreleased.
_______________________________________________
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