NSWindow does not support utility styleMask 0x10

本文介绍如何通过调整窗口类和样式属性,解决在使用NSPanel时遇到的警告问题,实现从NSPanel到NSWindow的平滑转换。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

NSPanel是有utility这个style的,而NSWindow没有 ,

先将这个window的class改成NSPanel,然后再将style改成regular,然后删除class名字NSPanel, 

则自动变成NSWindow,这样就不会有警告了。

Last login: Fri Jun 6 14:03:37 on ttys000 /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea ; exit; liuhuangsheng@liuhuangshengdeMacBook-Air ~ % /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea ; exit; 2025-06-06 14:03:44.965 idea[4826:170191] allVms required 1.8*,1.8+ 2025-06-06 14:03:44.982 idea[4826:170195] Current Directory: /Users/liuhuangsheng 2025-06-06 14:03:44.982 idea[4826:170195] parseVMOptions: IDEA_VM_OPTIONS = /Users/liuhuangsheng/Downloads/jetbra/vmoptions/idea.vmoptions 2025-06-06 14:03:44.983 idea[4826:170195] parseVMOptions: platform=-1 user=-1 file=(null) *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow should only be instantiated on the main thread!' *** First throw call stack: ( 0 CoreFoundation 0x000000019f4aee80 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x000000019ef96cd8 objc_exception_throw + 88 2 CoreFoundation 0x000000019f4d3534 _CFBundleGetValueForInfoKey + 0 3 AppKit 0x00000001a2fc4460 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 260 4 AppKit 0x00000001a3117520 -[NSPanel _initContent:styleMask:backing:defer:contentView:] + 48 5 AppKit 0x00000001a2fc4350 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 48 6 AppKit 0x00000001a31174d4 -[NSPanel initWithContentRect:styleMask:backing:defer:] + 48 7 AppKit 0x00000001a2fc30bc -[NSWindowTemplate nibInstantiate] + 216 8 AppKit 0x00000001a2f94af0 -[NSIBObjectData instantiateObject:] + 212 9 AppKit 0x00000001a2f944b4 -[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 252 10 AppKit 0x00000001a2f89f6c loadNib + 340 11 AppKit
06-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值