防止iCloud窗口在OSX 10.8应用程序启动时打开

问题描述:

我写了一个使用iCloud文档存储的OSX应用程序。每当我在Mountain Lion(而不是Lion)上打开它时,iCloud窗口会打开,如下所示:

I have written an OSX app that uses iCloud document storage. Whenever I open it in Mountain Lion (not on Lion), an iCloud window opens that looks like the following:

有没有办法防止这种情况发生?

Is there a way to prevent this from happening on launch?

更新

1) applicationShouldOpenUntitledFile:没有被调用(是的,我确定我在我的代理监听。

2)如果我强制退出应用程序,下次打开时,我没有得到对话框。但是,如果我通过正常的退出过程,它会出现。

1) applicationShouldOpenUntitledFile: is not getting called (yes, I'm sure I'm listening in my delegate.
2) If I force quit the app, the next time it opens, I don't get the dialog. But, if I go through the normal Quit process, it does appear.

更新2(也添加为答案,帮助可能绊倒这个问题):
来自重复问题的 applicationShouldOpenUntitledFile:无法正常工作。经过大量的实验,我想出如果我从 CFBundleDocumentTypes 中删除 NSDocumentClass 键和值从我的Info.plist > array,窗口不再打开。

Update 2 (also added as an answer, to help people that may stumble across this question in the future): The applicationShouldOpenUntitledFile: from the duplicate question was not working. After lots of experimentation, I figured out that if I remove the NSDocumentClass key and value from my Info.plist in the CFBundleDocumentTypes array, the window is no longer opened. I've added that answer to the duplicate question as well.

applicationShouldOpenUntitledFile:来自启用iCloud - 停止应用程序启动时显示的打开文件?无法正常工作。经过大量的实验,我想出如果我删除 NSDocumentClass 键和值从我的 Info.plist CFBundleDocumentTypes 数组,窗口不再打开。

The applicationShouldOpenUntitledFile: from iCloud enabled - Stop the open file displaying on application launch? was not working. After lots of experimentation, I figured out that if I remove the NSDocumentClass key and value from my Info.plist in the CFBundleDocumentTypes array, the window is no longer opened.