Remove Observer when using addObserverForName:usingBlock Remove Observer when using addObserverForName:usingBlock ios ios

Remove Observer when using addObserverForName:usingBlock


Seems the solution is to track the object in the View and then you can reference it in the dealloc methods.

 id observer = [[NSNotificationCenter defaultCenter] addObserverForName: /* ... */ ];

And then remove as following:

[[NSNotificationCenter defaultCenter] removeObserver:observer];observer = nil;