为什么在使用常规方法调用类接口中未声明的方法时会生成警告,但在使用@selector调用方法时却不会?是因为选择器可以由不同的调用者执行吗?
例如:
-(void) doStuff
{
[self doNow]; // Warning: instance method not found
SEL sel = @selector(doNow); // no warnings
}
-(void) doNow {} // this method is not declared in the interface
Run Code Online (Sandbox Code Playgroud)