Automatic OTP verification in iOS?

2019-03-09 11:24发布

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.

7条回答
霸刀☆藐视天下
2楼-- · 2019-03-09 12:15

In Xamarin iOS, for >=iOS 12:

First of all, the SMS need to have the keyword "code" or "passcode" into their message, and don't use spaces after the code. if you received the SMS and you have the button "Copy Code" then it will works

enter image description here

Then you need to place this:

_txtField = new UITextField()
{
   UserInteractionEnabled = true,
};
if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0))
{
  _txtField.TextContentType = UITextContentType.OneTimeCode;          
}
_txtFieldDelegate = new UITextFieldDelegate();
_txtField.Delegate = _txtFieldDelegate;
_txtField.BecomeFirstResponder();

NOTE: Security Code AutoFill will only works with System Keyboard (not custom).

查看更多
登录 后发表回答