I want to send a NSNotification to a specific object (to self), without having other objects see / respond to it.
Is this possible without editing the other objects?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, if you really must use the same notification name, one thought would be to put the self pointer into userInfo. Then on the observer side, if you don’t see a self pointer then you assume it’s a general notification, not specific to any particular observer.
If you do see a self pointer, you compare it to yourself to decide if to handle it. I’m not sure it satisfies your constraint of “no edits”, but it does at least satisfy the requirement that the superclass code doesn’t need to know of all the possible subclasses.