" - (bool)validateToolbarItem:(NSToolbarItem*)theItem"的冲突类型

Vin*_*pai 1 macos cocoa objective-c

我有这个代码:

- (BOOL) validateToolbarItem:(NSToolbarItem *)theItem {
    BOOL enable = NO;

    if (1 == [theItem tag]) {
        enable = YES;
    }

    return enable; 
}
Run Code Online (Sandbox Code Playgroud)

虽然程序按预期运行,但我收到此警告:

Conflicting types for '-(bool)validateToolbarItem:(NSToolbarItem *)theItem'
Run Code Online (Sandbox Code Playgroud)

我怎么能摆脱这个警告?谢谢.

Tho*_*asW 5

在其他地方,可能在标题中,您具有用bool(小写)声明的方法的类型.您需要使其与使用大写的已定义方法保持一致BOOL.

BOOL 是Objective-C中常用的东西.