Reputation: 951
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
Upvotes: 3
Views: 320
Reputation: 119272
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:
Upvotes: 1