3

If i do

[[NSNotificationCenter defaultCenter] postNotificationName:@"N" object:self];
NSLog(@"here");

The observer is notified synchronously before NSLog(@"here"); is executed... if all objects are on the same thread, is this guaranteed to be executed synchronously (immediately)?

Cannot find this to be explicitly stated

jscs
  • 63,694
  • 13
  • 151
  • 195
Zuzana Paulis
  • 941
  • 1
  • 8
  • 19

1 Answers1

1

Yes it is, quite well buried though:

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.

Source:

https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Notifications/Articles/NotificationQueues.html

jrturton
  • 118,105
  • 32
  • 252
  • 268