subclass says "unrecognized selector"
subclass says "unrecognized selector"
- Subject: subclass says "unrecognized selector"
- From: Mikkel Eide Eriksen <email@hidden>
- Date: Sat, 12 Feb 2011 14:52:39 +0100
Hi all,
I think I may have misunderstood something about how super works. In trying to build a dictionary that contains key/value pairs from the class itself as well as super classes up to an arbitrary height, I've hit a wall. Simplified, I have two classes, SuperClass and SubClass. In SuperClass, the following method is implemented:
-(NSDictionary *)tagDict
{
NSMutableDictionary *dict = //built from plist, different for each class
if ([self class] == [SuperClass class]) {
return dict; // we don't go above our own root
}
NSEnumerator *keyE = [[super tagDict] keyEnumerator]; //HERE
id key;
while (key = [keyE nextObject]) {
[dict setValue:[[super tagDict] valueForKey:key]];
}
return [dict copy];
}
When this runs, it works fine if I call tagDict on an instance of SuperClass, but if I try with SubClass, I get:
-[SubClass tagDict]: unrecognized selector sent to instance 0x20038efe0
But shouldn't it keep calling upwards until I reach the SuperClass, then stop and return my finished dict? I see that it appears to be calling [SubClass tagDict] which is the very method it's already in (so the selector can't very well be unrecognized, or what?)...
Regards,
Mikkel
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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