Editorial question12.6K views4,984 votes0 answers4,088 following
AI-generatedObserver <object> was not registered as an observer – duplicate removeObserver call
When developing with Foundation’s NSNotificationCenter, developers often need to clean up observers in deinit or cleanup routines. Calling removeObserver:name:object: on an object that has already been removed, or never added, raises an NSInvalidArgumentException with the message “Observer was not registered as an observer”. The decision point is whether to
observer-managementexception-handling
foundationTasadduq Burneyowner27.5K rep · 17 Jun 2023, 09:42 UTC