subclass says unrecognized selector

2011-02-12 Thread Mikkel Eide Eriksen
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

Re: subclass says unrecognized selector

2011-02-12 Thread claw
hi, why not try something like : if ( [self isKindOfClass:[SuperClass class] ] ) { } so your test will not depend on instance but on 'typeof' usually in code you use 'super' to verify that some data in 'super' already exist or need to be initialised between testing super self Le 12

Re: subclass says unrecognized selector

2011-02-12 Thread Jerry Krinock
First of all, I agree with claw that this line looks really weird, although it might work. I've just never seen it done that way. if ([self class] == [SuperClass class]) { Second, are you sure that SubClass inherits from SuperClass? Is it declared like this? … @interface SubClass :

Re: subclass says unrecognized selector

2011-02-12 Thread claw
also, NSEnumerator *keyE = [[super tagDict] keyEnumerator]; //HERE it is not a good strategy to use NSEnumerator at this point what if super does not respond at all ?? . to avoid crash infinite loop you needs to specify 'forward messaging' ( another instance object that will respond to

Re: subclass says unrecognized selector

2011-02-12 Thread Thomas Clement
super is relative to the class where this code is implemented (SuperClass) which means the method lookup starts with the super class of SuperClass. This true even when the code is called from a subclass. You're getting the unrecognized selector sent to instance message because the super class

Re: subclass says unrecognized selector

2011-02-12 Thread Andy Lee
super does not change what class the object thinks it is an instance of. (It's different from C++ in this way, if I remember my C++.) If an object is an instance of class X, [self class] *always* returns X. Suppose you call [obj tagDict] where obj is an instance of SubClass. This is what

Re: subclass says unrecognized selector

2011-02-12 Thread Mikkel Eide Eriksen
Thanks for the suggestions, all. I think this will probably suit my needs for now. Mikkel On 12/02/2011, at 17.06, Andy Lee wrote: super does not change what class the object thinks it is an instance of. (It's different from C++ in this way, if I remember my C++.) If an object is an

Re: subclass says unrecognized selector

2011-02-12 Thread Kyle Sluder
On Sat, Feb 12, 2011 at 5:52 AM, Mikkel Eide Eriksen mikkel.erik...@gmail.com wrote: 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

Re: subclass says unrecognized selector

2011-02-12 Thread Mikkel Eide Eriksen
On 12/02/2011, at 21.03, Kyle Sluder wrote: On Sat, Feb 12, 2011 at 5:52 AM, Mikkel Eide Eriksen mikkel.erik...@gmail.com wrote: 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

Re: subclass says unrecognized selector

2011-02-12 Thread Kyle Sluder
On Sat, Feb 12, 2011 at 12:37 PM, Mikkel Eide Eriksen mikkel.erik...@gmail.com wrote: Thanks for the suggestion, but I should mention that it needs to be an instance method since it gets the name of the plist from a userInfo dictionary on its entity (SuperClass is a subclass of