iOS Question Read SMS One time code

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Hi Happy New Year to you all.

I have an app and I would like to read a code sent via an SMS in B4i, just like B4a

I have found this reference on Stack Overflow, which talks about a TextContentType called 'UITextContentTypeOneTimeCode'.

How can I add that to an edit field in B4I?

Thanks
 

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
Try this:
B4X:
TextField1.As(NativeObject).RunMethod("setTextContentType:", Array("one-time-code"))
I tried this code as well as giving the edit field focus. Unfortunately it does not appear to work.

The SMS is received when the field has focus. The code appears in the keyboard paste selection, but the field is not automatically filled.
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
I tried several iterations:
  • Changed the keyboard, numbers, decimal, number plus punctuation etc
  • Used only numbers in the code.
  • Tried adding extra fields (this appeared in a post)
None of these things worked. I think I will leave it for now. The user will have to tap " From Messages " to copy the code.
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Please report back to the forum if you solve this in the future, I'm sure there are many that would like to be able to do this. (I, for one.)

Edit: If I happen to solve it first, I will obviously do the same.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…