Re: Turn off duplicate method warning
Re: Turn off duplicate method warning
- Subject: Re: Turn off duplicate method warning
- From: Trygve Inda <email@hidden>
- Date: Fri, 21 Jul 2006 20:51:19 +0000
- Thread-topic: Turn off duplicate method warning
> On Jul 21, 2006, at 5:09 AM, Trygve Inda wrote:
>> I have two methods:
>>
>> -(void)generate:(NSMutableDictionary *)dict
>>
>> This is in my main AppController (and in AppController.h), and it
>> calls
>>
>> -(QTMovie *)generate:(NSMutableDictionary *)dict
>>
>> which is in a different class that is loaded in a plug in. This one is
>> defined in a protocol file (which the AppController has to import).
>> I get a
>> "duplicate method" warning. How can I get rid of this?
>>
>> As the methods are in different classes, it should be fine (and the
>> code
>> works without problem).
>>
>> Thanks,
>>
>> Trygve
>
> I'm remembering something from class, and my memory tells me
> something about selectors being globally scoped. I.e., there's just
> one table that holds all the selectors, and I think the return type
> is not a sufficient discriminator. The second method would fail as an
> attempted method override, so maybe that's why you're getting the
> warning.
The first one is an action from a button:
-(IBAction)generate:(NSMutableDictionary *)dict // not void as above
> How do you invoke the second message call (what is the type of the
> reference you are using?) Is it an 'id'? If so, you might try casting
> it to the reference type of the actual Class or Protocol of the
> object instance.
-(QTMovie *)generate:(NSMutableDictionary *)dict is invoked as:
QTMovie = [[pluginInstances objectAtIndex:0] generate:dict]
So [pluginInstances objectAtIndex:0] is an instance of a class that conforms
to my protocol (in which generate returns a QTMovie).
I don't know how to cast [pluginInstances objectAtIndex:0] since I can't do
it to a specific class - only to a protocol since many classes can/will
conform to the protocol.
> Keep in mind I have just as much experience in Cocoa as you do, so
> maybe I'm the blind man trying to lead ;)
All blind here!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden