Re: unrecognized selector sent to instance
Re: unrecognized selector sent to instance
- Subject: Re: unrecognized selector sent to instance
- From: BJ Homer <email@hidden>
- Date: Wed, 15 Apr 2009 09:12:09 -0600
On Wed, Apr 15, 2009 at 9:02 AM, Bill Bumgarner <email@hidden> wrote:
> On Apr 15, 2009, at 7:04 AM, Jason Stephenson wrote:
>
>> So, the error that I get at runtime makes it appear that my
>> SIGIOBzip2OutputStream does not respond to the -[initToFileAtPath:append:]
>> selector, but it does. In the debugger, it looks as though
>> SIGIOBzip2OutputStream's super class is the object that doesn't respond to
>> that selector. But, it's superclass is NSOutputStream, and it is documented
>> to respond to that selector and I get no warnings about the selector when
>> compiling.
>>
>
> Actually, it doesn't. A subclass of NSOutputStream responds to that
> method.
>
> NSStream/NSOutputStream are both abstract classes with very specific
> subclassing notes.
>
> See the documentation:
>
>
> http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSOutputStream_Class/Reference/Reference.html
Which says:
> Subclassing Notes
The NSOutputStream is a concrete subclass of NSStream that lets you write
data to a stream. Although NSOutputStream is probably sufficient for most
situations requiring this capability, you can create a subclass of
NSOutputStream if you want more specialized behavior (for example, you want
to record statistics on the data in a stream).
Seems to be concrete to me. Nevertheless, calling it on super does throw an
exception; you might just try calling [super init] and see what happens.
Note that you'll also get exceptions on [super open] and [super close] in
those respective methods, since they're not defined on the superclass. Look
at the subclassing notes on both NSStream and NSOutputStream, and you'll be
closer.
>
> <http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSOutputStream_Class/Reference/Reference.html>
>
> And:
>
>
> http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSStream_Class/Reference/Reference.html#//apple_ref/occ/cl/NSStream
>
> There is a very specific set of methods you need to override. -init isn't
> one of them; you don't need to call super's implementation, apparently.
>
> b.bum
>
_______________________________________________
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