Notification not removed

51 Views Asked by At

Using Swift4. In one of my ViewControllers I use some Notifications. The observer is in the ViewDidLoad. The calls are in a view that I lay over the VC. This for a generic menu.

When exiting the VC I call NotificationCenter.default.removeObserver(self) to remove the notifications.

The Notifications point to a simple routine:

@objc func thisHandler() {
    print("This print statement appears")
}

Further in the app, I do some stuff and suddenly the print statement above appears in the log.

I have tried to remove the observer both in: viewWillDisappear, deinit and even the prepare:for segue:sender. This message keeps apperearing. I have checked with other print statements that these routeines are executed.

This only occurs (afaik) when I have opened the Camera/Photo folder. What am I missing?

0

There are 0 best solutions below