【发布时间】:2019-05-24 01:47:36
【问题描述】:
到目前为止,我已经尝试了每种文档类型和委托方法,但我的非基于文档的应用程序不接受停靠图标上的任何拖放文件/文件夹。
这是我从 Apples Notes 应用程序复制的文档类型,它支持在其图标上放置文件夹:
<dict>
<key>CFBundleTypeName</key>
<string>General files and folders</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>public.folder</string>
</array>
</dict>
委托设置正确,否则我的applicationWillFinishLaunching根本不会被调用。
我尝试实现任何一个
application(_ sender: NSApplication, openFile filename: String) -> Boolapplication(_ sender: NSApplication, openFiles filenames: [String])
没有成功。我只是无法让停靠图标接受下降。我错过了什么?
更新:
事实证明,我必须将 Debug 构建拖到 /Applications 才能接受拖动。至少可以说,这非常麻烦。有什么办法吗?
【问题讨论】: