小编Ste*_*rns的帖子

为什么Xcode在使用@selector时不会抱怨未声明的方法?

为什么在使用常规方法调用类接口中未声明的方法时会生成警告,但在使用@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)

iphone xcode objective-c selector ios

5
推荐指数
1
解决办法
3311
查看次数

标签 统计

ios ×1

iphone ×1

objective-c ×1

selector ×1

xcode ×1