iOS 12 SMS Reading API?

前端 未结 6 923
既然无缘
既然无缘 2021-01-12 01:07

In Beta version of iOS 12 I have observed it gives OTP(from SMS) in keyboard suggestion.
So is there any API which they have created for developers ? Or that would just

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-12 01:28

    It is OS feature but you need to set UITextField's input view’s textContentType property oneTimeCode.

    otpTextField.textContentType = .oneTimeCode
    

    NOTE: Security Code AutoFill will only works with System Keyboard it will not work with custom keyboard.

    When you get OTP it will look something like this:

提交回复
热议问题