Home What is use of "object" parameters while adding observer in objective-c?
Reply: 0

What is use of "object" parameters while adding observer in objective-c?

user1212
1#
user1212 Published in June 18, 2018, 3:35 am

This question already has an answer here:

  • what is param for object, nsnotification addObserver 3 answers

Normally, I'm using nil in object parameter while adding observer in any class. Now, My Question is what is use of object parameter while adding observer, for posting, I can understand that, It's useful for pass any object as notification object.

[[NSNotificationCenter defaultCenter] addObserver:self selector: @selector(testMethod:) name:@"userDetailUpdatedNotification" object: nil];

Yes, This is bit silly question but please explain me if you have knowledge about it. So, I can't miss any advantage of passing object while adding observer.

As per this question's answer, I've still confusion. If it's for filtering only why it's not as boolean type and which kind of object it's require. If possible please explain me using some example.

Regards,

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.29823 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO