1

我已经在这个问题上遇到了几天,并且无法为我的生活弄清楚我做错了什么(或者如果这是某种错误):

我有一个自定义的 Mac 应用程序(如果重要的话,在 Java 中)。它本质上采用特定类型的文档包,对其进行一些处理,然后将结果发送到服务器。除了用户将“文件”拖放到应用程序的停靠图标上的一个用例之外,我一切正常。

到目前为止,我所读到的所有内容似乎都表明,放在 Mac Dock 图标上使用的启动服务与 Finder 使用的相同。然而,打开 Applications 目录并在其中放置应用程序是可行的,而在 Dock 中放置应用程序图标则什么也没做。

所以,到目前为止我尝试过的一些细节:

  • 应用程序处理带有 *.foo 扩展名的文档,它们是文档包(即 opt-click 提供“显示包内容”选项)
  • 文档的 UTI 为 org.example.foo,符合 UTI com.apple.package 和 public.composite-content(所有信息从所有者应用程序 Info.plist 导出的类型 UTI 键复制)
  • Info.plist 在 Imported Type UTI 中声明此文档类型(UTImportedTypeDeclarations 键)
  • 同样在 Info.plist 中,UTI 在文档类型(CFBundleDocumentTypes 键)中声明
    • CFBundleTypeExtensions 包括“foo”
    • CFBundleTypeOSTypes 设置为“****”

Dock 图标上的 Cmd-Opt-drop(强制放置)什么也不做。删除 Finder 完全符合预期。因此,这似乎是专门放置在 Dock 图标上的问题。

关于改变什么的任何想法?

4

1 回答 1

2

Maz has hit the heart of the issue, I think. The application is set up to run in Mac OS X 10.5 or 10.6, and the Java APIs I am using (com.apple.eawt.*) appear to be deprecated without replacements; which likely explains why it mostly works, but doesn't work in annoying ways.

It seems the actual solution will involve reverse-engineering the JavaApplicationStub executable to work with the newer APIs, and make JNI hooks so that the proper events get passed along to my application.

于 2010-07-01T21:06:29.007 回答