Determining if an Objective-C method is variadic during runtime

你离开我真会死。 提交于 2019-12-05 10:35:54

Robert's comment is correct. Consider:

@interface Boogity
@end
@implementation Boogity
- (void)methodWithOneIntArg:(int)a {;}
- (void)variadicMethodWithIDSentinel:(id)a, ... {;}
@end

Running strings on the resulting binary produces (there was also the stock main()):

strings asdfasdfasdf 
Boogity
methodWithOneIntArg:
variadicMethodWithIDSentinel:
v20@0:8i16
v24@0:8@16
Hello, World!

If I change the variadic method to be declared as - (void)variadicMethodWithIDSentinel:(int)a, ..., the strings output becomes:

Boogity
methodWithOneIntArg:
variadicMethodWithIDSentinel:
v20@0:8i16
Hello, World!

So, no, no way to tell.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!