2013-02-26 51 views
0

我有一个视图控制器基于UITableViewController,我想收到更新通知时重新加载表视图:刷新表视图时收到通知

我张贴在其他类通知:

[[NSNotificationCenter defaultCenter] postNotificationName:@"UpdateApStatus" object:self]; 

错误是:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MenuViewController updateApStatus:]: unrecognized selector sent to instance 0xb25bf80' 

好像我无法访问self

回答

1

updateApStatus中删除“:”。如果函数的参数不是这样,那么只会使用冒号。因此,添加冒号是完全不同的选择器,这是它无法识别的原因。

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateApStatus) name:@"UpdateApStatus" object:nil];