我使用NSNotifiationCenter,像其他1000次,併發布通知,但我的觀察員沒有聽到它?是什麼賦予了?發佈nsnotification,但觀察員沒有聽到它
===這是我泰伯維===
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleSuccessSocket)
name:kNotificationServiceStartSuccessful
object:self];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleFailedSocketConnection)
name:kNotificationSocketFailedToConnect
object:self];
}
===這是我SOCKETMANAGER(插座管理器,如果該事項單身)===
-(void)willStartService {
....
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationServiceStartSuccessful object:nil];
....
}
我調試了,viewDidLoad在我的視圖中被調用。是的,我的willStartService正在被調用。