Removes all entries specifying a given observer from the notification center's dispatch table.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The observer to remove.
If your app targets iOS 9.0 and later or macOS 10.11 and later, you don't need to unregister an observer in its
dealloc method. Otherwise, you should call this method or
remove before observer or any object specified in
add is deallocated.
You shouldn't use this method to remove all observers from a long-lived object, because your code may not be the only code adding observers that involve the object.
The following example illustrates how to unregister
some for all notifications for which it had previously registered. This is safe to do in the
dealloc method, but should not otherwise be used (use