Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的应用程序中使用 NSNotification,但似乎当我以非常接近的时间间隔发送两个通知时,通知无序到达 - 我第一个发送的通知最后收到。
我想知道是否有办法确保按发送顺序处理通知。
提前谢谢。
如果您发布简单的通知(不分发,不在其他线程等),通知将完全同步处理。即,在您致电 [NSNotificationCenter postNotification...] 之后,通知将被所有观察者发送和接收。在这种情况下,乱序是不可能的。