我的系统拒绝使用 NSAppleScript 类关闭/重新启动
我在 10.5 上使用 CFPlugin
作为上下文菜单和图标覆盖(与 scplugin
相同)。对于我的应用程序和 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 来执行苹果脚本。现在我正在使用 NSTask 并且我的系统重新启动/关闭/注销工作正常。谁能解释一下原因吗?
I am using CFPlugin
for contextual menu and icon overlay on 10.5(same as scplugin
). For communication between my application and finder , i am using distributed object
. After installing my plugin inside Contextual menu items
folder , my system refuse to restart/shutdow/Logout. In activity monitor i am unable to quit finder , only force quit is woking for finder.
On console I am getting on 10.5.8
ERROR | -[ApplicationManager(AppleEventHandling) _tryQuitAllForRequestor:replyEvent:] | _tryQuitAllForRequestor - _vproc_set_global_on_demand returned error -1805620379
Without communication between Finder and my application, system restart/shutdow/Logout are working fine.
On 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
Can anyone please help me out?
EDIT
My problem is solved. I was using NSAppleScript
for executing apple script. Now i am using NSTask and my system restart/shutdow/Logout are working fine. can anyone please explain me reason for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
NSAppleScript 只能从主线程运行,因此主线程在运行时将被阻塞。
不太确定该消息的根本原因是什么,但我假设脚本无法找到或正常运行,然后主线程被阻塞或超时,并且所有关闭序列都被卡住。
另一方面,NSTask 是正确的多线程,因此序列不会被阻止,并且您的计算机将正确关闭。
以下是一些相关链接:
NSAppleScript can only be run from the main thread, so the main thread is going to be blocked while it is running.
Not too sure what is the root cause of the message, but I am supposing the script can not be found or run properly, and then the main thread is blocked or timed out, and all your shutdown sequence gets stuck.
On the opposite side, NSTask is properly multithreaded so the sequence won't be blocked, and your computer will properly shutdown.
Here are a few relevant links gathered around:
我的问题解决了。我使用 NSAppleScript 来执行苹果脚本。现在我正在使用
NSTask
并且我的系统重新启动/关闭/注销工作正常My problem is solved. I was using
NSAppleScript
for executing apple script. Now i am usingNSTask
and my system restart/shutdow/Logout are working fine