others - 在React-native中,如何实现人脸识别认证?

我是React Native的新手,我想在应用程序中实现face id和touch id身份验证,但面部识别不能工作,face id身份验证代码如下所示:


 callFinger(isLogin) {


 TouchID.isSupported()


 .then(biometryType => {



 if (biometryType === 'TouchID') {



 TouchID.authenticate('Unlock with your fingerprint').then(success => {


 if (success) {


 if (isLogin =="true")


 this.callRedirect(isLogin);


 else


 this.callLoginApi();


 }


 }


 );


 } else if (biometryType === 'FaceID') {


 TouchID.authenticate('Unlock with your FaceID').then(success => {


 if (success) {


 if (isLogin =="true")


 this.callRedirect(isLogin);


 else


 this.callLoginApi();


 }


 }


 );


 } else if (biometryType === true) {



 TouchID.authenticate('Unlock with your fingerprint').then(success => {


 if (success) {


 if (isLogin =="true")


 this.callRedirect(isLogin);


 else


 this.callLoginApi();


 }


 }


 );


 }


 else {


 this.callRedirect(isLogin);


 }


 })


 .catch(error => {


 this.callRedirect(isLogin);


 })



}



https://www.npmjs.com/package/react-native-touch-id

我还引用了下面的链接,但它也无法工作,https://github.com/naoufal/react-native-touch-id/blob/master/examples/BiometricAuthExample/App.js

时间:

尝试在您的ios//info.plist添加


<key>NSFaceIDUsageDescription</key>


<string>Enabling Face ID allows you quick and secure access to your account.</string>



...