0

I want to pre fill the verification code in my app's textfield once the user gets an SMS for verifying their number. But, due to security concerns, I don't think that feature is available on iOS. Now, I want to achieve something similar to WhatsApp. When I enter my number in WhatsApp, it sends me a verification code as well as a text that reads,"click here to proceed further". On clicking that link, I am redirected to WhatsApp and my mobile verification process is complete. I want to achieve something similar.

Sanjay Shah
  • 502
  • 2
  • 13
Isha Balla
  • 733
  • 2
  • 9
  • 25
  • Possible duplicate of [Read SMS message in iOS](https://stackoverflow.com/questions/16187841/read-sms-message-in-ios) – Dharma Jul 17 '17 at 11:26

1 Answers1

1

Yes, similar kind of thing can be achievable by using DeepLinking. You need to deep link the page to open particular screen of the app through link.

URLSchems also come in handy for this kind of requirement. For that your app has to whitelist the Scheme identifier it's going to use. So that through that URL scheme you OS will open your app. Send a message with URLScheme.

URLScheme looks like this: MyApp://myapp.com?VerificationCode="65636"

Now you need to get that parameter by using following methods:

func application(app: UIApplication, openURL url: NSURL, options: [String: AnyObject]) -> Bool {

      scheme = url.scheme
      path = url.path
      query = url.query

      return true
    }

Now send that parameter to your server to verify. That's it.

Sivajee Battina
  • 4,124
  • 2
  • 22
  • 45