Posted from the
invalidate() method, which is invoked when the
NSPort is deallocated or when it notices that its communication channel has been damaged. The notification object is the
NSPort object that has become invalid. This notification does not contain a
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
NSSocket object cannot detect when its connection to a remote port is lost, even if the remote port is on the same machine. Therefore, it cannot invalidate itself and post this notification. Instead, you must detect the timeout error when the next message is sent.
NSPort object posting this notification is no longer useful, so all receivers should unregister themselves for any notifications involving the
NSPort. A method receiving this notification should check to see which port became invalid before attempting to do anything. In particular, observers that receive all
did messages should be aware that communication with the window server is handled through an
NSPort. If this port becomes invalid, drawing operations will cause a fatal error.