On May 29, 2008, at 12:59 PM, Robert Kukuchka wrote:

I'm trying to add a simple category to NSMutableData, but when I try to call my method I'm getting "*** -[NSConcreteData remainderDataWithParseByte:]: unrecognized selector sent to instance 0x816400". I've added categories to NSString and NSArray before, which have similar abstract interfaces to concrete classes. Is there some trick I'm missing?

Have you verified that the object really isKindOfClass:[NSMutableData class] ?

Using class-dump on the Foundation framework shows me that NSConcreteData subclasses NSData, while NSConcreteMutableData is a subclass of NSMutableData.

Given the nature of class clusters and the private concrete classes within them, I suppose it's possible that you did everything right (asked for an NSMutableData) but were given an NSConcreteData instead, and that it does the right thing in almost all cases. I'd still consider it a bug in the framework if a category on NSMutableData didn't work on it, if that's the case.

Cheers,
Ken
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to