- (void)refresh:(id)sender{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshFinished:) name:@"refresh.contacts" object:nil];
}
-(void)refreshFinished{
}
出错
'NSInvalidArgumentException', reason: '-[ContactsViewController refreshFinished:]: unrecognized selector sent to instance 0xe65ccc0'
解决:
@selector(refreshFinished:) 去除":"即可
如果refreshFinished需要传参数,就需要加入":"
本文介绍了一个关于 Objective-C 通知中心使用不当导致的 'unrecognized selector' 错误,并给出了具体的解决方法。错误源自通知响应方法声明不正确。
2871

被折叠的 条评论
为什么被折叠?



