respondsToSelector
在ARC环境中致电时,出现以下错误消息Automatic Reference Counting Issue
No known instance method for selector respondsToSelector:
这是标题
#import <AppKit/AppKit.h>
@class MTScrollView;
@protocol MTScrollViewDelegate
-(void)scrollViewDidScroll:(MTScrollView *)scrollView;
@end
@interface MTScrollView : NSScrollView
{
}
@property(nonatomic, weak) id<MTScrollViewDelegate>delegate;
@end
这是实施文件
#import "MTScrollView.h"
@implementation MTScrollView
@synthesize delegate;
- (void)reflectScrolledClipView:(NSClipView *)aClipView
{
[super reflectScrolledClipView:aClipView];
if([delegate respondsToSelector:@selector(scrollViewDidScroll:)])
{
[delegate scrollViewDidScroll:self];
}
}
@end
关于我为什么会收到此错误的任何建议?
respondsToSelector
是的实例方法,NSObject
因此系统需要知道该委托是NSObject