如何在沙盒应用程序中使用辅助功能? [英] How to use Accessibility with sandboxed app?

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

问题描述

OS X具有一个很好的功能,例如Accessibility API,它可以从您的应用程序代码控制某些系统元素和另一个应用程序.但是,在启用沙箱后,它将停止工作.要向商店提交应用程序,则必须启用沙箱功能.

OS X have a nice feature such as Accessibility API, which allow to control some system elements and another applications from your app code. But it stops working after turning on Sandbox. To submit an app to the store is mandatory to turn on sandboxing.

这就是苹果所说的话:

使用应用程序沙箱",您可以并且应该启用应用程序的可访问性,如本文档中所述.但是,您不能对诸如屏幕阅读器之类的辅助应用程序进行沙箱操作,也不能对控制另一个应用程序的应用程序进行沙箱处理.

With App Sandbox, you can and should enable your app for accessibility, as described in this document. However, you cannot sandbox an assistive app such as a screen reader, and you cannot sandbox an app that controls another app.

但是App Store有一些使用Accessibility API的应用程序:

But App Store has a few applications that use Accessibility API:

  • Cinch –调整Windows大小
  • BetterSnapTool-相同
  • PopClip –获取选定的文本

因此,这意味着可以一起使用Sandbox/Accessibility API/App Store,但如何使用?

So it means that it is possible to use Sandbox/Accessibility API/App Store together, but how?

推荐答案

从几年前开始,可访问性API在OS X沙箱中尚不可用,但可能已更改.但是,这些应用程序更有可能从Apple处获得了特殊例外,并且它们具有更多的沙箱授权,这些特权可以部分地将其从沙箱中分离出来,足以让它们使用可访问性API.

As of a couple of years ago, Accessibility APIs were not available from within the OS X sandbox, but that might have changed. It is more likely, however, that those apps managed to get a special exception from Apple, and that they have additional sandboxing entitlements that partially break them out of the sandbox just enough to let them use the accessibility APIs.

您应该做的是首先通过bugreporter.apple.com提交错误,告知您要使用可访问性进行的操作以及原因,然后要求它们给您提供沙箱异常.如果他们批准了该例外,他们可能会为您提供一些自定义的沙箱配置文件语言代码,使您可以从(有些减弱)的沙箱中调用可访问性API.

What you should do is first file a bug via bugreporter.apple.com, telling what you're trying to do with accessibility and why, and asking them to give you a sandboxing exception. If they approve the exception, they will probably give you a custom bit of sandbox profile language code that makes it possible to call the accessibility APIs from within the (somewhat weakened) sandbox.

话虽如此,取决于您在做什么,如果Apple说:抱歉,该应用不适合应用商店模型.请在禁用沙箱的情况下使用开发人员ID对您的应用进行签名,然后在商店外分发."

With that said, depending on what you're doing, don't be surprised if Apple says, "Sorry, that app doesn't fit the app store model. Please sign your app using Developer ID with sandboxing disabled, and distribute it outside the store."

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

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