objective-c - Objective C 中的多播委托(delegate)

标签 objective-c iphone

我正在使用 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/

相关文章:

objective-c - iOS: 在 UIImageView 中保存图片

ios - 在同一个应用程序中从右到左和从左到右的语言?

objective-c - 为什么我的整个 View 都在动画,而不仅仅是我的 UIImage View

ios - 多个自定义单元格

iPhone 应用程序因信号 9 随机崩溃

iphone - 屏幕上 CALayers 的混合模式?那可能吗?

objective-c - 在 Objective-C 中转换相同的代码会得到另一个数值结果

iphone - Objective-C:如何使用 xAuth?

iphone - 设置UITableViewCell删除控件的背景颜色

iPhone - 具有两个音频 channel 的 MOV 视频