我在上下文菜单和图标叠加上使用CFPlugin 10.5(与scplugin相同)。为了在我的应用程序和finder之间进行通信,我正在使用distributed object。在Contextual menu items文件夹中安装插件后,系统将拒绝重新启动/关闭/注销。在活动监视器中,我无法退出finder,只有force quit为finder工作。
在控制台上10.5.8

ERROR | -[ApplicationManager(AppleEventHandling) _tryQuitAllForRequestor:replyEvent:] | _tryQuitAllForRequestor - _vproc_set_global_on_demand returned error -1805620379

在Finder和我的应用程序之间没有通信的情况下,系统重启/关闭/注销工作正常。
10.5.4节
loginwindow[41]: ERROR | WSActivateApp | SetFrontProcess({0, 7980956}) returned error -600. Unable to activate process.

loginwindow[41]: ERROR | -[ApplicationManager(AppleEventHandling) _tryQuitAllForRequestor:replyEvent:] | _tryQuitAllForRequestor - _vproc_set_global_on_demand returned error -1780878507

有人能帮我吗?
编辑
我的问题解决了。我使用NSAppleScript执行apple脚本。现在我正在使用nstask,我的系统重启/关闭/注销工作正常。有人能解释一下原因吗?

最佳答案

nsapplescript只能从主线程运行,因此主线程在运行时将被阻塞。
不太确定消息的根本原因是什么,但是我假设脚本找不到或运行正常,然后主线程被阻塞或超时,并且所有的关闭序列都被卡住。
另一方面,nstask是多线程的,因此序列不会被阻塞,您的计算机将正确关闭。
下面是一些相关的链接:
http://deusty.blogspot.com/2006/11/nsapplescript-is-slow.html
NSTask Launch causing crash
http://www.cocoabuilder.com/archive/cocoa/226818-nsapplescript-returns-wrong-result-on-multiple-safari-windows-applescript-editor-work.html
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSAppleScript_Class/Reference/Reference.html

关于objective-c - 我的系统拒绝使用NSAppleScript类关闭/重新启动,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9179268/

10-12 12:40