OGeek|极客世界-中国程序员成长平台

标题: ios - 如何从 SEL 中获取参数类型 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 14:01
标题: ios - 如何从 SEL 中获取参数类型

我有一个来自字符串的 SEL。我可以使用“method_copyArgumentType”这是一个运行时函数来获取每个参数的类型,就像这样

char *arguType = method_copyArgumentType(m, i);//here m is a Method type,and i is the index of the argument
NSLog(@"method argNum=%d,%s",i,arguType);

通过这种方式,如果参数类型是id,它会打印“@”,但我不知道它是什么类,比如NSArray或NSDictionary。

有没有办法获取参数的具体类型?



Best Answer-推荐答案


没有。类中方法的描述不记录具体类的参数类型。

关于ios - 如何从 SEL 中获取参数类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18570016/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4