Skip navigation.
 
mlRe: Turn off duplicate method warning
FROM : Trygve Inda
DATE : Fri Jul 21 22:51:19 2006

> 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!

Related mailsAuthorDate
mlTurn off duplicate method warning Trygve Inda Jul 21, 14:09
mlRe: Turn off duplicate method warning Rob Ross Jul 21, 16:38
mlRe: Turn off duplicate method warning Trygve Inda Jul 21, 22:51
mlRe: Turn off duplicate method warning Mike Blaguszewski Jul 21, 23:22
mlRe: Turn off duplicate method warning Uli Kusterer Jul 22, 19:46