0

Coming from Python I'm trying to learn Objective-C. When I have an object in Python I can always easily do a dir(myObject) to see what methods it has. So I wonder, what is the equivalent command in Objective-C?

kramer65
  • 50,427
  • 120
  • 308
  • 488
  • possible duplicate of [List selectors for obj-c object](http://stackoverflow.com/questions/330030/list-selectors-for-obj-c-object) – Martin R Sep 01 '13 at 18:52

1 Answers1

1

Apple's Objective C Runtime Reference may have the answers you need.

I'm thinking you might want to consider:

"class_copyMethodList" to start with. Keep in mind there are both instance methods and class methods to keep track of.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • I always thought objects are simply instances of classes, which means that the methods of the instance are the same as that of the class (except for when any methods are added to the object after the instantiation of the object). Where am I wrong here? – kramer65 Sep 01 '13 at 19:02
  • [There definitely is a difference between instance and class methods](http://stackoverflow.com/questions/1053592/what-is-the-difference-between-class-and-instance-methods). – Michael Dautermann Sep 01 '13 at 19:04
  • @kramer65: In Objective-C, you cannot add methods to a *specific instance* of a class. (I am not a Python expert, but that seems to be possibly in Python.) - You can dynamically add instance methods (which are stored in the class) or class methods (which are stored in the metaclass). – Martin R Sep 01 '13 at 19:13
  • Ah, learned another thing; class methods are more like static methods which can be called without creating an object while instance methods can only be used when an object is created. Correct? – kramer65 Sep 02 '13 at 15:01