MulticastDelegate in ObjectiveC

I use the MulticastDelegate class, which is part of the xmpp framework and adopted here. It works great for me! However, I received a warning:

'MulticastDelegate' may not respond to 'SomeMethod'

Is there any way to avoid warning for this class? Thanks in advance.

+3
source share
3 answers

What is that someMethod? Did you include the title MulticastDelegate.h?


Update: Aha, in this case you need to tell the compiler that the delegate implements the interface Notifier:

#import "MulticastDelegate.h"

@protocol Notifier
- (void) someMethod; 
@end

@interface Manager
{
   MulticastDelegate <Notifier> delegate;
}
@end

. ? , delegate someMethod, delegate MulticastDelegate? - ?

+2

"MulticastDelegate.h", someMethode , "MulticastDelegate.h", .

GCC , , , .

0

@protocol Notifier
 -(void) someMethod; 
@end

class

#import "MulticastDelegate.h"

@interface Manager
{
       MulticastDelegate delegate; 
}
@end

-

delegate= [[MulticastDelegate alloc] init];
.....
- (void)addDelegate:(id)_delegate
{
    [delegate addDelegate:_delegate];
}

[delegate someMethod];

, .

'MulticastDelegate' may not respond to 'SomeMethod'

0
source

Source: https://habr.com/ru/post/1720859/


All Articles