TouchId不支持Iphone 7 react-native

时间:2017-05-26 13:40:09

标签: ios iphone react-native react-native-ios touch-id

我做了一个使用react-native的TouchId身份验证示例,但是这个显示" TouchId不受支持"

任何人都有同样的问题吗?

我的设备是模拟器。但是当我在真实设备中运行它时问题是一样的。

有功能

  _isSupported = async () => {
      try {
          await TouchId.isSupported()
          Alert.alert('TouchId is supported!')
      } catch(e) {
          Alert.alert('TouchId is not supported!')
      }
  }

  _trggerTouchId = async () => {
      let description = 'Verify the existing mobile phone fingerprint using the home key'
      //let title       //fallback button title will be default as 'Enter Password'(localized) 
      //let title = ""  //fallback button will be hidden 
     let title = "Verify Password"   //fallback button title will be 'Verify Password'(unlocalized) 
     try {
          await TouchId.verify({
              description,
              title,
          });
          //await TouchId.verify("123123123123"); 
          Alert.alert('verify succeeded')
     } catch(e) {
          if (e.code == '-3') {
              //fallback button is pressed 
              Alert.alert('errorCode: ' + e.code + ' verify failed, user wants to ' + title)
          }
          else {
              Alert.alert('errorCode: ' + e.code + ' verify failed')
          }
      }
  }

1 个答案:

答案 0 :(得分:0)

几个月前我已经解决了这个问题。最后,问题出在应用程序上 TouchId 的设备配置和权限。代码很好。