NSNotification not being sent when postNotificationName: called

后端 未结 7 801
生来不讨喜
生来不讨喜 2020-12-29 08:17

I\'m trying to get one instance of using NSNotificationCenter with addObserver and postNotificationName but I can\'t work out why it w

相关标签:
7条回答
  • 2020-12-29 09:09

    All my code makes use of NSNotifications like so:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateView) name:@"ScanCompleted" object:nil];
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"ScanCompleted" object:nil];
    

    The first one is registering the notification and the second posting of the notification.

    0 讨论(0)
提交回复
热议问题