Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6372791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:16:54+00:00 2026-05-25T01:16:54+00:00

In all the tutorials or examples I find, they show a colon after the

  • 0

In all the tutorials or examples I find, they show a colon after the selector name (getCurrentData:), like so:


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

Since there is nothing after this colon in the examples, I assume that the method specified does not take any arguments. And mine doesn’t either, but when I use the above syntax my app crashes and says unrecognized selector sent to instance I remove the colon, and it works. So why do all examples show a colon?

Secondly, if I did use a selector that required an argument, how can I do that? If I do this:

[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(createButtons:@"ten grand";)
name:@"mapsReceived"
object:nil ];

It won’t even compile; I get tons of errors until I remove the text string and the colon. Yet I can call this method, with the string, just fine when using it outside NSNotification. Is there a way to do what I want here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:16:54+00:00Added an answer on May 25, 2026 at 1:16 am

    First, most all examples assume that you are passing the notification to the method. For example:

    - (void)respondToNotification:(NSNotification *);
    

    This would be represented as:

    @selector(respondToNotification:)
    

    If you removed this argument, it would be

    @selector(respondToNotification)
    

    As for the second item, you cannot specify arguments in that manner. You need to architect your methods in such a way that it receives the notification as the argument, and then you can inspect the notification and call another method to perform whatever action you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All of the tutorials and examples I find online always specify a port number
All the tutorials and examples I've found of XSLT processing seem to assume your
Almost all of the examples in the jQuery tutorials that I've read, usually use
Django tutorials everywhere use constant-set application name all around - in urls file, in
I googled a lot now, but all I find are Hello World examples for
I'm learning Eclipse PDT for PHP development. In pretty much all tutorials I've read
All the tutorials I have seen seem to use *.jsf , *.faces , or
This is very dumb - but I've seen all the tutorials and guides -
I think all of the tutorials and stuff are great on blogs, but sometimes
So followed all the basic tutorials. Am using Zend 1.8 but i keep getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.