runtime在函数参数中使用了类型编码作为其中一个参数,用来标识函数的返回值及参数的类型。
首先类型编码可以使用@encode()来查看。
| CODE | MEAN |
|---|---|
| c | A char |
| i | An int |
| l | A long |
| q | A long long |
| C | An unsigned char |
| I | An unsigned int |
| S | An unsigned short |
| L | An unsigned long |
| Q | An unsigned long long |
| f | A float |
| d | A double |
| B | A C++ bool |
| v | A void |
| * | A (char *) |
| @ | An object(id) |
| # | A Class |
| : | A SEL |
| [array type] | An array |
| {name=...} | A structure |
| {name=type...} | A union |
| ? | A unknown type |
这是类型编码对应的类型