17

I'm reading Apple's article about Objective-C runtime type encoding strings and some methods have numbers in their type strings.

What do the numbers in v12@0:4@8 mean?

jscs
  • 63,694
  • 13
  • 151
  • 195
Ecir Hana
  • 10,864
  • 13
  • 67
  • 117

1 Answers1

26

This looks like an encoding of a setter method like this:

- (void) setSomething:(id) anObject

To break it down:

  • v means void return type
  • 12 means the size of the argument frame (12 bytes)
  • @0 means that there is an Objective-C object type at byte offset 0 of the argument frame (this is the implicit self object in each Objective-C method)
  • :4 means that there is a selector at byte offset 4 (this is the implicit _cmd in every method, which is the selector that was used to invoke the method).
  • @8 means that there is another Objective-C object type at byte offset 8.
dreamlax
  • 93,976
  • 29
  • 161
  • 209
  • So the first number is the argument frame size, and others are offsets...thanks! – Ecir Hana Jul 15 '12 at 13:12
  • 8
    Note for future readers: [bbum says the offset numbers are meaningless at this point](http://stackoverflow.com/a/11527925/603977). – jscs Feb 01 '13 at 20:24
  • . 12 is not the size of the argument frame, which becomes more clear if you see my question [here](http://stackoverflow.com/questions/41502199/deciphering-objc-method-description-in-swift-conversion-decoding-questions) – clearlight Jan 07 '17 at 18:35