NSNotificationCenter: Do objects receive notifications on the same thread they are posted?

后端 未结 2 608
予麋鹿
予麋鹿 2020-12-31 02:47

I am interested in knowing whether I can expect the observing object\'s method to be pushed onto the stack before the posting object\'s method has been completed and removed

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-31 03:30

    The short answer is yes... "Regular notification centers deliver notifications on the thread in which the notification was posted. Distributed notification centers deliver notifications on the main thread".

    However, Apple has docs on this very subject that you may find helpful, and from which the above quote was pulled:

    Notification Programming Topics: Delivering Notifications to Particular Threads

提交回复
热议问题