哪些API会触发“应用程序希望使用可访问性功能来控制此计算机"? [英] Which APIs trigger "app would like to control this computer using accessibility features"?

查看:50
本文介绍了哪些API会触发“应用程序希望使用可访问性功能来控制此计算机"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在较新的macOS版本上,我的应用突然显示了此安全警告:

I've noticed that on newer macOS versions my app suddenly shows this security warning:

(由于我的系统是德语,因此截图来自此处)

(screenshot taken from here because my system is in German)

现在,我想知道为什么macOS会显示此信息.我不记得使用任何辅助功能,但是我当然必须使用某些功能,因为否则将不会出现此安全警告.我已经检查过代码,没有使用 NSAccessibility 中的任何功能.但是,由于我收到了此警告,因此还必须有其他调用来触发它.但是如何找到它们呢?

Now I'm wondering why macOS is showing this. I don't remember using any accessibility features but of course I must be using some because otherwise this security warning would not appear. I've checked my code and I'm not using any features from NSAccessibility. But since I get this warning, there must be other calls that trigger it as well. But how to find them?

这就是为什么我想问我如何找出实际上导致此安全警告出现的哪些Cocoa API?我应该找什么?是否存在触发此警告的函数/类的列表?

That's why I'd like to ask how I can find out what Cocoa APIs are actually causing this security warning to appear? What should I look for? Is there a list of functions/classes that trigger this warning?

请注意,我没有使用Xcode,而是使用一组Makefile以非常老式的方式构建应用程序.

Note that I'm not using Xcode but I'm building my app in a very old-fashioned way using a set of makefiles.

推荐答案

这并不是对问题的完整回答,但至少我现在已经找到了罪魁祸首.我那里有一些代码,允许用户以编程方式移动鼠标光标.禁用此代码会使警告消失.代码如下:

This is not really a complete answer to the question but at least I've found out the culprit now. I had some code in there that allowed the user to programmatically move the mouse cursor. Disabling this code made the warning go away. The code looks like this:

CGPoint p;
CGEventRef me;

p.x = x;
p.y = y;

if(!(me = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, p, 0))) return;

CGEventPost(kCGHIDEventTap, me);
CFRelease(me); 

这篇关于哪些API会触发“应用程序希望使用可访问性功能来控制此计算机"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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