iphone notification results in “unrecognized selector sent to instance

- (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需要传参数,就需要加入":"

猜你喜欢

转载自jimmy-miao.iteye.com/blog/1770788