View All Notifications Sent To Your Application

This tip shows how to see all notifications that are generated while running your application. This can come in handy if you need to understand the types of notifications available and the order they occur, with the idea that your application could benefit from registering for a specific type of notification(s).

To see all notifications displayed to the console, add the following code inside the App Delegate:

[[NSNotificationCenter defaultCenter] addObserver:self 
    selector:@selector(notificationReceived:) name:nil object:nil];
 
...
 
-(void)notificationReceived:(NSNotification*)notification
{
  NSLog(@"Notification:%@ from:%@",[notification name], 
    [[notification object] description] );
}

Here is a sample output:

Comments are closed.