NSWorkspace openFile:随机把焦点回到我的应用程序 [英] NSWorkspace openFile: randomly brings focus back to my app

查看:285
本文介绍了NSWorkspace openFile:随机把焦点回到我的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Cocoa应用程序中,我调用NSWorkspace的openFile:方法以使用其默认应用程序打开一些文件。

Within my Cocoa app, I call NSWorkspace's openFile: method to open some file with its default application.

有时这种方法很好, ,因为它应该。

Sometimes this works just fine, and the other application gets focus, as it should.

但是唉,有时(其发生似乎是完全随机的),焦点短暂地对其他应用程序后,它很快回来到我的Cocoa应用程序。这是不想要的。

But alas, sometimes (the occurrence of which seems to be totally random), after the focus goes briefly to the other application, it goes quickly back to my Cocoa app. This is unwanted.

任何想法的原因是什么?

Any ideas what the causes could be?

注意:我也试过openFile :withApplication:andDeactivate :,将YES传递给最后一个参数。这也不工作。

Note: I have also tried the openFile:withApplication:andDeactivate:, passing YES to the last argument. This doesn't work either. The strange random occurrences of focus going back to my Cocoa app persist.

推荐答案

我现在无法再现这种情况。不确定是什么问题。

I'm unable to reproduce this now. Not sure what the problem was.

这篇关于NSWorkspace openFile:随机把焦点回到我的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆