Instance Property

object

The object associated with the notification.

Declaration

@property(readonly, retain) id object;

Discussion

This is often the object that posted this notification. It may be nil.

Typically you use this method to find out what object a notification applies to when you receive a notification.

For example, suppose you’ve registered an object to receive the message handlePortDeath: when the PortInvalid notification is posted to the notification center and that handlePortDeath: needs to access the object monitoring the port that is now invalid. handlePortDeath: can retrieve that object as shown here:

Listing 1

Example of accessing notification object.

- (void)handlePortDeath:(NSNotification *)notification
{
    ...
    [self reclaimResourcesForPort:notification.object];
    ...
}

See Also

Getting Notification Information

name

The name of the notification.

userInfo

The user information dictionary associated with the notification.