我有一个类方法,没有在头文件中声明,但是在实现文件中实现了。现在我想在另一个类中调用它,由于返回值是int类型,不能直接使用selector,所以我使用了NSInvocation。
下面是我的操作:
SEL selector = ***;
NSMethodSignature *signature = [classA methodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
invocation.selector = selector;
invocation.target = [classA class];
[invocation setArgument:(void *)arg atIndex:2];
[invocation invoke];
为什么 Invoke 没有成功执行?