iPhone application – reading SMS
Solution 1:
Intercepting/reading incoming SMS is not possible on iOS (for privacy reasons).
Solution 2:
It is only possible when the phone is Jailbreaked. There are many tools to jailbreak your phone.
Once Jailbreaked, an application cal open the SQLite database at
/var/mobile/Library/SMS/sms.db
and read the message
table.
It contains, the date/time at which the message was received, the sender/recipient phone number and even the clear text of the message.
Solution 3:
UPDATE
From iOS 12 Apple will allow the support to read One Time Code(OTP - One Time Password) which you will get in the iPhone device.
iOS 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
instoryboard/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.