gpt4 book ai didi

objective-c - '-(bool)validateToolbarItem:(NSToolbarItem *)theItem' 的类型冲突

转载 作者:行者123 更新时间:2023-12-03 16:52:52 25 4
gpt4 key购买 nike

我有这个代码:

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

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

return enable;
}

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

Conflicting types for '-(bool)validateToolbarItem:(NSToolbarItem *)theItem'

如何摆脱这个警告?谢谢。

最佳答案

在其他地方,可能在 header 中,您拥有用 bool (小写)声明的方法的类型。您需要使其与使用大写 BOOL 的定义方法一致。

BOOL 是 Objective-C 中常用的。

关于objective-c - '-(bool)validateToolbarItem:(NSToolbarItem *)theItem' 的类型冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9407116/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com