1 步.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(actionNotification:)
name:kNotificationName object:nil];
});
2 步.
- (void) actionNotification: (NSNotification*)notification
{
NSString* message = notification.object;
NSLog(@"%@",message);
sleep(5);
NSLog(@"Action Notification Finish");
}
3 步.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSNotification *notification = [NSNotification notificationWithName:kNotificationName
object:@"object"];
[[NSNotificationQueue defaultQueue] enqueueNotification:notification
postingStyle:NSPostASAP];
});