我正在使用 MulticastDelegate 类,它是 xmpp 框架 的一部分并采用了 here它非常适合我!但是我收到警告:
'MulticastDelegate' may not respond to 'someMethod'
有什么办法可以避免这个类的警告吗? 提前致谢。
最佳答案
那是什么someMethod
?您是否包括了 MulticastDelegate.h
header ?
更新:啊哈,在那种情况下你需要告诉编译器委托(delegate)实现了 Notifier
接口(interface):
#import "MulticastDelegate.h"
@protocol Notifier
- (void) someMethod;
@end
@interface Manager
{
MulticastDelegate <Notifier> delegate;
}
@end
这应该可以。但是代码是不是有点可疑?当 delegate
是普通的 MulticastDelegate
时,您怎么知道 delegate
实现了 someMethod
?您是否在示例中遗漏了什么?
关于objective-c - Objective C 中的多播委托(delegate),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1611754/