As the title described.
I want to prevent duplicated observer adding so that the selector would not be called twice.
As the title described.
I want to prevent duplicated observer adding so that the selector would not be called twice.
No, it's not possible. You can either call removeObserver
method just before adding observer to make sure you didn't add it twice or subclass NSNotificationCenter
and register all observers yourself.
P.S. Have you tried adding observer twice? Is your selector also called twice?