Automatic OTP verification in iOS?

后端 未结 12 1261
遥遥无期
遥遥无期 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条回答
  •  庸人自扰
    2020-12-01 04:22

    UPDATE

    From iOS 12 Apple will supports Password AutoFill on UITextField, UITextView, and any custom view that adopts the UITextInput protocol. System keyboard set the textContentType on it to .oneTimeCode

    1) Using Code

    singleFactorCodeTextField.textContentType = .oneTimeCode

    2) Using Storyboard/XIB

    Select UITextField/UITextView in storyboard/XIB click Click on Attribute inspector. Go to text input trait, click to Content type and select one time code and done.

    The operating system will detect verification codes from Messages automatically with this UITextContentType set.

    Warning

    If you use a custom input view for a security code input text field, iOS cannot display the necessary AutoFill UI.

    For more information, you can check it on the Apple developer oneTimeCode

    And also review WWDC 2018 Session 204 - Automatic Strong Passwords and Security Code AutoFill and jump to 24:28 for automatic pre-fill the OTP.

提交回复
热议问题