如何在启用了沙箱的助手应用程序中终止我的应用程序? [英] How can I terminate my app in a helper app with sandboxing enabled?

查看:164
本文介绍了如何在启用了沙箱的助手应用程序中终止我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个助手应用程序,该应用程序可以监视iTunes并启动/终止主应用程序.

I've created a helper app, which monitors iTunes and launches/terminates the main app.

发射工作完美. 唯一的问题是,由于沙箱操作,我不允许终止主应用程序. 我得到了这3条日志:

The launching works perfectly. The only problem is that I'm not allowed to terminate the main app, because of sandboxing. I get those 3 logs:

12/23/12 8:45:37.522 PM appleeventsd[70]: Sandboxed application with pid 8293 attempted to lookup App:"Significator 2"/8877/0x0:0x150150 ???? sess=100011 but was denied due to sandboxing. (handleMessage()/appleEventsD.cp #2007) com.apple.coreservices.appleevents.peer.0x7fd9c2401f00.xpcq


12/23/12 8:45:37.000 PM kernel[0]: Sandbox: sandboxd(8888) deny mach-lookup com.apple.coresymbolicationd


12/23/12 8:45:37.873 PM sandboxd[8888]: ([8293]) SignificatorHelp(8293) deny appleevent-send ch.ilijatovilo.significator-2

我已经尝试过在助手应用中像这样终止它:

I've tried terminating it like this in the helper app:

NSRunningApplication *app = [[NSRunningApplication runningApplicationsWithBundleIdentifier:[self mainApplicationBundle].bundleIdentifier] objectAtIndex:0];
[app terminate];

当然,我可以在主应用程序中添加另一个观察者,但是我想避免这种情况.

Of course, I could add another observer in the main app, but I want to avoid that.

推荐答案

知道了,我不得不添加一个临时的权利例外:

Got it, I had to add a temporary entitlement exception:

<key>com.apple.security.temporary-exception.apple-events</key>
<array>
    <string>mainAppBundleIdentifier</string>
</array>

这篇关于如何在启用了沙箱的助手应用程序中终止我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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