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 997575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:03:24+00:00 2026-05-16T07:03:24+00:00

There are some functions which take as an argument @selector(methodName). I used NSLog to

  • 0

There are some functions which take as an argument @selector(methodName). I used NSLog to find out what @selector is, and it returns an integer. It looks like a PID, but when I ran ps ax that PID could not be found. What does that integer represent and why do we have to use @selector all the time instead of just passing the method name?

  • 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-16T07:03:25+00:00Added an answer on May 16, 2026 at 7:03 am

    @selector() is a compiler directive to turn whatever’s inside the parenthesis into a SEL. A SEL is a type to indicate a method name, but not the method implementation. (For that you’d need a different type, probably an IMP or a Method) Under-the-hood, a SEL is implemented as a char*, although relying on that behavior is not a good idea. If you want to inspect what SEL you have, the best way to do it is to turn it into an NSString* like this:

    NSLog(@"the current method is: %@", NSStringFromSelector(_cmd));
    

    (Assuming you know that _cmd is one of the hidden parameters of every method call, and is the SEL that corresponds to the current method)

    The Objective-C Programming Language Guide has much more information on the subject.

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

Sidebar

Related Questions

Is there a syntax for documenting functions which take a single configuration array, rather
I have some code written by someone else in which some functions take arguments
There are some JS functions that are IE specific. I am working on an
I heard that in PHP there are some alternatives for the functions substr() and
I'm refactoring some code and there are tons of functions with no try catch
Is there some function that returns the parent directory of a file in Perl?
When a function which take a pointer in argument is inlined, does the compiler
Is there some function in haskell that evaluates to (filter p xs, filter (not.p)
Is there some inbuilt function to return weekdayname based on value 1-7? /M
Is there some way to write a function f :: (a -> b ->

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.