swift QLPreviewPanel crash — NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints

…衆ロ難τιáo~ 提交于 2019-12-24 18:53:02

问题


I am trying to open a preview panel:

QLPreviewPanel.shared().makeKeyAndOrderFront(self) for a valid QLPreviewItem (url).

This works well for regular files, but crashes on folders and some specific urls, for example vnc internet connection files (.vnc).

The console error:

[Layout] Unable to simultaneously satisfy constraints: ( "", "", "", "", "" )

Will attempt to recover by breaking constraint

Set the NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have -[NSWindow visualizeConstraints:] automatically called when this happens. And/or, set a symbolic breakpoint on LAYOUT_CONSTRAINTS_NOT_SATISFIABLE to catch this in the debugger.

Given the hint, I set NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES:

UserDefaults.standard.set(true, forKey: "NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints") UserDefaults.standard.synchronize()

But this does not help at all. The exact same error is thrown. My application still crashes.

Adding NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints as an argument did not work either. Nor did using an int (1) instead of a boolean (true) make any difference.

I am lost now, because my app crashes and I have no clue how to solve this. Any help to solve this would be highly appreciated.

update/addition

FWIW: I did not set any constraints myself, or make any other configuration. Just try to open a panel with using the default API. Code is working correctly for pdf and other kinds of regular files. Crashes on VNC, folders.

来源:https://stackoverflow.com/questions/54363591/swift-qlpreviewpanel-crash-nsconstraintbasedlayoutvisualizemutuallyexclusivec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!