NSWorkspace openFile: randomly brings focus back to my app
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.
开发者_JAVA百科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?
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.
精彩评论