Recovering a list of selectors to which an object can respond

  • I can't find a way to recover a list of selectors to which an object can
    respond, or a list of subclasses for a specified class. Either I'm searching
    at the wrong places, or the introspection feature in cocoa is very poor...
    Someone knows if Is there a way to achieve these goals?
    Thanks in advance!
  • On Sep 18, 2007, at 10:57 AM, Gustavo Vera wrote:

    > I can't find a way to recover a list of selectors to which an
    > object can
    > respond, or a list of subclasses for a specified class. Either I'm
    > searching
    > at the wrong places, or the introspection feature in cocoa is very
    > poor...
    > Someone knows if Is there a way to achieve these goals?

    In the general case getting a list of selectors isn't very useful...
    usually you have a message you want to send and query the target
    object to see if it responds to it.

    With that said...

    <http://developer.apple.com/documentation/Cocoa/Reference/
    ObjCRuntimeRef/Reference/reference.html
    >

    -Shawn
  • Answering to myself, I believe that here is the solution

    http://developer.apple.com/documentation/Cocoa/Reference/ObjCRuntimeRef/Ref
    erence/reference.html#//apple_ref/c/func/class_nextMethodList


    On 9/18/07, Gustavo Vera <gustavovera...> wrote:
    >
    > I can't find a way to recover a list of selectors to which an object can
    > respond, or a list of subclasses for a specified class. Either I'm searching
    > at the wrong places, or the introspection feature in cocoa is very poor...
    > Someone knows if Is there a way to achieve these goals?
    > Thanks in advance!
    >
  • On Sep 18, 2007, at 10:57 AM, Gustavo Vera wrote:

    > I can't find a way to recover a list of selectors to which an
    > object can
    > respond, or a list of subclasses for a specified class. Either I'm
    > searching
    > at the wrong places, or the introspection feature in cocoa is very
    > poor...
    > Someone knows if Is there a way to achieve these goals?

    What problem are you trying to solve?

    Generally questions like this tend to create a really long thread
    that ends up with someone pointing out that you do the equivalent
    thing in a completely different way that no one mentioned because it
    didn't answer the original question :).
    --
    David Duncan
    Apple DTS Quartz and Printing
    <david.duncan...>
  • I believe we found the same thing, thanks anyway!

    On 9/18/07, Shawn Erickson <shawnce...> wrote:
    >
    >
    > On Sep 18, 2007, at 10:57 AM, Gustavo Vera wrote:
    >
    >> I can't find a way to recover a list of selectors to which an
    >> object can
    >> respond, or a list of subclasses for a specified class. Either I'm
    >> searching
    >> at the wrong places, or the introspection feature in cocoa is very
    >> poor...
    >> Someone knows if Is there a way to achieve these goals?
    >
    > In the general case getting a list of selectors isn't very useful...
    > usually you have a message you want to send and query the target
    > object to see if it responds to it.
    >
    > With that said...
    >
    > <http://developer.apple.com/documentation/Cocoa/Reference/
    > ObjCRuntimeRef/Reference/reference.html>
    >
    > -Shawn
    >
    >
  • On 18 sep 2007, at 19.57, Gustavo Vera wrote:

    > I can't find a way to recover a list of selectors to which an
    > object can
    > respond, or a list of subclasses for a specified class. Either I'm
    > searching
    > at the wrong places, or the introspection feature in cocoa is very
    > poor...
    > Someone knows if Is there a way to achieve these goals?
    > Thanks in advance!
    > _______________________________________________
    >
    This can be done using lowlevel functions in the Objective C Runtime.
    See the book Anguish - Buck - Yachtman , Cocoa Programming, from Sams
    Publishing
    for examples.
    ------------------------------------------------------------------------
    ------------
    This sig is dedicated to the advancement of Nuclear Power
    Tommy Nordgren
    <tommy.nordgren...>
  • I wanna define a place where the developers could implement (following
    certain rules and name conventions)  functionality to perform data migration
    between different database schemes. Those functions should be sequentially
    executed by the app during first execution, when previous versions of the
    data were detected. When a developer generates changes in the data schema,
    he should implement also the corresponding migration functionality just for
    that change.  The app will execute just the set of needed migration
    functions for the data previously generated by older app versions.

    9/18/07, David Duncan <david.duncan...> wrote:
    >
    > On Sep 18, 2007, at 10:57 AM, Gustavo Vera wrote:
    >
    >> I can't find a way to recover a list of selectors to which an
    >> object can
    >> respond, or a list of subclasses for a specified class. Either I'm
    >> searching
    >> at the wrong places, or the introspection feature in cocoa is very
    >> poor...
    >> Someone knows if Is there a way to achieve these goals?
    >
    > What problem are you trying to solve?
    >
    > Generally questions like this tend to create a really long thread
    > that ends up with someone pointing out that you do the equivalent
    > thing in a completely different way that no one mentioned because it
    > didn't answer the original question :).
    > --
    > David Duncan
    > Apple DTS Quartz and Printing
    > <david.duncan...>
    >
    >
    >
  • On Sep 18, 2007, at 11:07 AM, Gustavo Vera wrote:

    > Answering to myself, I believe that here is the solution
    >
    > http://developer.apple.com/documentation/Cocoa/Reference/ObjCRuntimeRef/Ref
    erence/reference.html#/

    > /apple_ref/c/func/class_nextMethodList

    Note that getting the methods implemented on a class is not the same
    as getting the messages that the class or an instance of that class
    can respond to.  Even if you get the superclass methods too (and so on
    up the chain), the class may choose to handle messages at runtime that
    it has no explicit method for.

    In general, it's better to ask a class if it can respond to a
    particular message than to ask it for a collection of methods.  What
    higher-level task are you really trying to accomplish by asking a
    class for its subclasses or its methods?

      -- Chris
  • On 9/18/07, Chris Hanson <cmh...> wrote:
    >
    > On Sep 18, 2007, at 11:07 AM, Gustavo Vera wrote:
    >
    >> Answering to myself, I believe that here is the solution
    >>
    >>
    > http://developer.apple.com/documentation/Cocoa/Reference/ObjCRuntimeRef/Ref
    erence/reference.html#/

    >> /apple_ref/c/func/class_nextMethodList
    >
    > Note that getting the methods implemented on a class is not the same
    > as getting the messages that the class or an instance of that class
    > can respond to.  Even if you get the superclass methods too (and so on
    > up the chain), the class may choose to handle messages at runtime that
    > it has no explicit method for.
    >
    > In general, it's better to ask a class if it can respond to a
    > particular message than to ask it for a collection of methods.  What
    > higher-level task are you really trying to accomplish by asking a
    > class for its subclasses or its methods?

    Well, actually, I don't really need to ask a class for its subclasses (not
    at this moment at least), I just asked also about that just as a possible
    (probably even more complicated) workaround for what I want to implement, if
    nobody answered the main question. Thanks!

      -- Chris
    >
    >
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today