Scenes:
After sending and receiving text messages, almost all smart phones on the market now provide the function of copying the verification code, and some mobile phones can even automatically fill in the verification code into the input box.
So it appeared during the development process, the verification code will be automatically pasted into the input box twice.
Describe the picture:
Step 1: Copy the verification code
Step 2: Paste, and there is a problem
Cause
IOS system, or the problem of the SMS control used by other systems, it will automatically trigger the UITextField.TextFieldTextDidChangeNotification event twice, refer to the article
Therefore, it will be automatically inserted twice.
solution
The simplest solution is to set the maximum length of the text box to the length of the text message.
This needs to be clearly understood before development, what is the length of the short message for calling the interface.