有一种这样的方法。有没有办法从Method结构中获取参数的类类型?
- (void)method: (CustomClass)param;
CustomClass
继承自NSObject
。
下面我有一个变量m
,这是该方法的Method
结构。 我调用method_getArgumentType()
获得参数类型是这样的:
char szArgType[100] = {0,};
Method m = ...;
...
method_getArgumentType(m, 2, szArgType, 100);
我打印szArgType
。它打印@
,但我想打印CustomClass
。 在运行时,是否有一种很好的方法可以从Method
获取参数的真实对象类类型?
另请参阅:[如何获取ivar的ObjC类?](http://stackoverflow.com/questions/11265503/如何做我的目标-c-class-ivar/11266383#11266383) –