How to enable/disable OneTimeCode feature for specific text field?

后端 未结 3 1488
故里飘歌
故里飘歌 2020-12-22 02:58

For OTP text field, I have set textContentType as oneTimeCode

if #available(iOS 12.0, *) {
     otpTextField.textContentType = .oneTimeCode
}    
3条回答
  •  没有蜡笔的小新
    2020-12-22 03:37

    Your approach with content-type is correct , but there are few things to consider to make it work , Such as

    • Security code is only work with System keyboard. So avoid using custom keyboard.
    • Make sure otp message phrase has “code” or “passcode” and message is copyable.

    Also , I implemented this by following steps given in below link

    Reference Link : https://medium.com/@shankarmadeshvaran/how-to-implement-automatic-otp-verification-in-ios-7813c6116a1d

    Hope It Helps

提交回复
热议问题