代码之家  ›  专栏  ›  技术社区  ›  Era

在非基于文档的应用程序中拖动文件夹以停靠图标

  •  0
  • Era  · 技术社区  · 7 年前

    这是我从Apple 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) -> Bool
    • application(_ sender: NSApplication, openFiles filenames: [String])

    没有成功。我只是不能让码头图标接受一个下降。我错过了什么?

    更新:

    Debug 构建到 /Applications

    1 回复  |  直到 7 年前
        1
  •  1
  •   Era    7 年前

    这看起来很奇怪,但我做了些什么来让它工作起来:

    • Debug 构建到 /Applications
    • 启动它并拖动一个文件到它
    • 再次从Xcode构建并运行应用程序。Drop现在也可以用于外部的Xcode构建 /应用
    • ,下降仍然有效。