我正在 Xcode / ObjC 中开发一个辅助 MacOS 应用程序。
它使用事件点击拦截击键。
当我从 Xcode 运行它时,我得到:
2019-07-05 06:20:32.423783+0300 mapper[8108:1191874] unable to create event tap. must run as root or add privileges for assistive devices to this app.
2019-07-05 06:20:32.423809+0300 mapper[8108:1191874] No Event tap in place! You will need to call listen after tapEvents to get events.
我必须去system preferences -> security & privacy -> privacy -> {unlock the padlock putting my admin password} -> {locate, uncheck and recheck my executable from the list}
,像这样:
每次修改一行代码,再次运行,都要经过这个检查和取消检查的过程。
这是一个非常笨拙的开发周期。
有没有办法避免这种情况?