• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
subclass says "unrecognized selector"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: subclass says "unrecognized selector"
      • From: Kyle Sluder <email@hidden>
    • Re: subclass says "unrecognized selector"
      • From: Andy Lee <email@hidden>
    • Re: subclass says "unrecognized selector"
      • From: Thomas Clement <email@hidden>
    • Re: subclass says "unrecognized selector"
      • From: claw <email@hidden>
  • Prev by Date: Re: Looking for suggestions/help on a multi-file data model
  • Next by Date: Re: subclass says "unrecognized selector"
  • Previous by thread: Re: Looking for suggestions/help on a multi-file data model
  • Next by thread: Re: subclass says "unrecognized selector"
  • Index(es):
    • Date
    • Thread