Re: help with closing file handle
Re: help with closing file handle
- Subject: Re: help with closing file handle
- From: Daniel Luis dos Santos <email@hidden>
- Date: Sat, 9 Feb 2008 12:03:04 +0000
From what I understood, In your opinion it seems that I supplied a
NSArray to the NSFileHandle instead of a NSString.
But I didn't. I passed the argument to the [NSFileHandle:
fileHandleForReadingAtPath] as a string literal (@"...").
I still don't get it.
On Feb 8, 2008, at 4:15 PM, Kyle Sluder wrote:
On Feb 8, 2008 8:06 AM, Daniel Luis dos Santos
<email@hidden> wrote:
When I run it, while stepping through the closing of the file handle,
the gdb window shows the
error :
2008-02-08 11:56:09.166 TesterBundleDebugger[408] *** -[NSCFArray
appendString:]: selector not recognized [self = 0x30a9a0]
2008-02-08 11:56:09.167 TesterBundleDebugger[408] *** Uncaught
exception: <NSInvalidArgumentException> *** -[NSCFArray
appendString:]: selector not recognized [self = 0x30a9a0]
I don't understand what is happening.
We're going to think through this like programmers, so that maybe you
can nail bugs like this yourself in the future.
Read carefully: something's trying to send -appendString: to an
NSArray (NSCFArray is the name of the real, concrete toll-free-bridged
subclass of NSArray that we all use unknowingly). -[NSFileHandle
closeFile] is the method causing the problem, and we can safely assume
that the implementation of NSFileHandle is correct. The only thing
you're provided to it is the NSString you received as the first
argument to -useArchive:. -appendString: is indeed defined on
NSMutableString.
Seems like we've found a likely cause of the issue: the NSString
you're getting and giving to NSFileHandle is really an NSCFArray;
whoever called -useArchive: screwed up. There should have been a
warning generated about "distinct Objective-C types". If you haven't
already, turn on "treat warnings as errors" in your project settings.
--Kyle Sluder
_______________________________________________
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