postNotificationName 是否保证立即发送给听众?
Is postNotificationName guaranteed to dispatch immediately to listeners?
如果我这样做
[[NSNotificationCenter defaultCenter] postNotificationName:@"N" object:self];
NSLog(@"here");
在NSLog(@"here");
执行之前同步通知观察者... 如果所有对象都在同一个线程上,是否保证同步(立即)执行?
找不到要明确说明的内容
是的,虽然埋得很好:
Using the NSNotificationCenter’s postNotification: method and its variants, you can post a notification to a notification center. However, the invocation of the method is synchronous: before the posting object can resume its thread of execution, it must wait until the notification center dispatches the notification to all observers and returns.
来源:
如果我这样做
[[NSNotificationCenter defaultCenter] postNotificationName:@"N" object:self];
NSLog(@"here");
在NSLog(@"here");
执行之前同步通知观察者... 如果所有对象都在同一个线程上,是否保证同步(立即)执行?
找不到要明确说明的内容
是的,虽然埋得很好:
Using the NSNotificationCenter’s postNotification: method and its variants, you can post a notification to a notification center. However, the invocation of the method is synchronous: before the posting object can resume its thread of execution, it must wait until the notification center dispatches the notification to all observers and returns.
来源: