我在程序集中有这个初始化程序:
- (id<APBSearchWireframeInterface>)searchWireframe {
return [TyphoonDefinition withClass:[APBSearchWireframe class] configuration:^(TyphoonDefinition *definition) {
[definition injectProperty:@selector(searchViewController) with:[self searchViewController]];
[definition injectProperty:@selector(mapFromSearchInput) with:[[self mapAssembly] mapWireframe]];
}];
}
最后一行,当注入mapFromSearchInput
时,我收到警告
undeclared selector 'mapFromSearchInput'
我在APBSearchWireframe
@interface APBSearchWireframe()
@property (nonatomic, readwrite, strong) id<APBSearchView> searchViewController;
@property (nonatomic, readwrite, strong) id<APBMapFromSearchInput> mapFromSearchInput;
@end
mapWireframe
符合多个接口
- (id<APBMapWireframeInterface, APBMapFromSearchInput>)mapWireframe;
如果我将属性定义从私有扩展名移动到.h,警告就会消失。为什么我第二次注入时出错,但是第一次注入没有?我已正确完成所有导入,并且应用程序正常,但此警告真的很烦人......
谢谢。
答案 0 :(得分:1)
你有没有确保:
@class Something
)和#import
在.m中? 如果是这样并且错误仍然存在,那么编译器似乎感到困惑。你可以:
示例:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
... your code here ...
#pragma clang diagnostic pop