Automatic OTP verification in iOS?

后端 未结 12 1260
遥遥无期
遥遥无期 2020-12-01 03:23

Is there any way to access data from iPhone inbox(SMS) to ios application to do automatic OTP verification like the one in Android? I shall be grateful for your help.

12条回答
  •  萌比男神i
    2020-12-01 04:10

    In iOS 12 Apple has introduced feature called Security Code AutoFill.

    To use this in your app all you need to do is 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.

    WWDC video

    When you get OTP it will look something like this:

提交回复
热议问题