Is it possible to automate touch ID or face ID using xcuitest in simulator?

橙三吉。 提交于 2019-12-10 19:47:51

问题


Is there a way to automate face ID or Touch ID using xcuitest framework in simulator. Manually I can perform enrolling face/touch id and perform matching or non-matching scenarios. However I would like to know if it can be automated?


回答1:


Given this post by Kane Cheshire it is possible to automate touch ID and face ID for unit testing by sending a Darwin notification like so :

+ (void)enrolled {
  int token;
  notify_register_check("com.apple.BiometricKit.enrollmentChanged", &token);
  notify_set_state(token, 1);
  notify_post("com.apple.BiometricKit.enrollmentChanged");
}

Only in Objective-C though, so you may need to use a bridging header.

Import the files Biometrics.m and Biometrics.h from his demo on Gitub and you will be able to call Biometrics.enrolled() from your XCTestCase.



来源:https://stackoverflow.com/questions/53555625/is-it-possible-to-automate-touch-id-or-face-id-using-xcuitest-in-simulator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!