Re: subclass says "unrecognized selector"
Re: subclass says "unrecognized selector"
- Subject: Re: subclass says "unrecognized selector"
- From: claw <email@hidden>
- Date: Sat, 12 Feb 2011 16:35:11 +0100
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 tadDict ), so your code will be weird again with if ( if ( if (
NSEnumerator will be better to count the number of 'plist' file exist in a bundle to prepare the quantity of dictionnary.
Le 12 févr. 2011 à 16:19, Jerry Krinock a écrit :
> 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 : SuperClass
>
> Finally, although this is not your current problem, the following line violates Cocoa Memory Management conventions:
>> return [dict copy];
>
> Read this:
> http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/MemoryMgmt/MemoryMgmt.html
>
>> 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?)
>
> No, if it did that it would be a recursive method, and possibly an infinite loop.
>
> _______________________________________________
>
> 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
_______________________________________________
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