View controllers sometimes do not receive an NSNotification

前端 未结 3 1562
情深已故
情深已故 2021-01-28 00:22

So, I am just testing NSNotifications on a variety of cases and this one is confusing. I would appreciate it if you could help me understand NSNotifications !

I have a N

3条回答
  •  囚心锁ツ
    2021-01-28 01:26

    "The first time when you send the notification, other view controllers don't exist. They haven't been created yet. The viewController is still nil yet. Since there is no observer object, you don't get any logs. Second time around, both objects in the view controllers have been created. So they receive the notification as they are alive and the log the received notification statements."

提交回复
热议问题