使调试器控制台中的 macOS Storyboard 警告静音

问题描述

我正在创建一个自定义 NSToolbar,具有自定义显示和大小(基于您的 macOS 版本),使用 Storyboards(我知道,我知道......起诉我,但出于重要原因需要在 Storyboards 中完成)给客户)。

但是,由于所有这些自定义属性,我的控制台现在因对象裁剪警告而过载:

2021-02-10 09:47:47.293075-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.
2021-02-10 09:47:47.293154-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.
2021-02-10 09:47:47.294598-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.
2021-02-10 09:47:47.294663-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.
2021-02-10 09:47:47.295465-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.
2021-02-10 09:47:47.295524-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.
2021-02-10 09:47:47.300350-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.
2021-02-10 09:47:47.300413-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.
2021-02-10 09:47:47.305839-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.
2021-02-10 09:47:47.305915-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.
2021-02-10 09:47:47.306702-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.
2021-02-10 09:47:47.306761-0500 Demo[27503:2117437] [NSToolbarItem] NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.

我已经尝试实现我发现的唯一一致的 StackOverflow solutions 以及 this gist 的我自己的 macOS 变体 - 仍然没有骰子。

UserDefaults.standard.setValue(false,forKey: "_UIConstraintBasedLayoutLogUnsatisfiable")

是否有针对基于 Cocoa 的 Storyboard 的 macOS 解决方案可以让我消除这些警告?

此外,我试图找到 Apple 包含的 UserDefaults 的列表,但没有找到任何有用的资源。开发人员在哪里可以找到诸如 "_UIConstraintBasedLayoutLogUnsatisfiable" 之类的 UserDefault 键?

编辑:如果有一个静音的解决方案会更好,例如,对象裁剪警告或警告这个特定的 NSToolbar/NSWindow。我不想想要关闭所有故事板警告 - 因为这是最后的手段。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)