Flutter_Pinput
Flutter_Pinput copied to clipboard
autofill not working on ios
I tried to use the autofill and it works perfectly with andriod but its not working with the ios
Pinput( androidSmsAutofillMethod: AndroidSmsAutofillMethod.smsUserConsentApi, length: 6, focusNode: _pinOTPCodeFocus, controller: _pinOTPController, defaultPinTheme: PinTheme( textStyle: TextStyle( color: Colors.white, fontSize: 16, ), width: 40.0, height: 50.0, decoration: pinOTPCodeDecoration), pinAnimationType: PinAnimationType.rotation, onCompleted: _onCompleted)
User should tap on the code which should be shown on top of the keyboard
try autofocus: true
this will open the keyboard automatically, and when user receives a SMS the code should pop up
i tired this but the code dosnt apear on the keyboard
Hello @Tkko,
unfortunately I have the same issue on IOS. If I put for example the autofillHints: [AutofillHints.email], that's working fine, but the sms code didn't appear. I am using the firebase sms authentication. After the code was sent a chapcha screen appear and disappear. I don't know if it can influence the functionality.
Best regards, Norbert
Hi @szusznorbert,
- Share example of sms
- Are you passing any
autofillHints
? I just tried sending the sms"verification code: 1233"
to my phone number while on https://flutter_pinput.codemagic.app/ and it works, check if it works for you as well.
In working
I mean this:
Hi @Tkko ,
first of all thank you for your fast reply. I didn't use any autofillHints. I have just tried just to be sure that the feature is working. I got the problem source. I tried your app, and I could get the code from my keyboard. Seems that the problem was that the firebase sent me the verification sms in Hungarian not in English. If I switched the language to English than it's working fine. Is there any possibility to handle the sms language? I suppose that the phone language should be also set to Hungarian in order to work the code cutting.
Thank you! Norbert
@szusznorbert Interesting, I haven't had that issue before, and I'm not sure what's the workaround here, please let me know if you find the solution.
Hi @Tkko
I am facing a similar issue on iOS. I tried the codemagic link on my device and the autofill was not always working.
- I tried sending
verification code: 1234
and it was working fine. - But when I sent the sms as
The one time password to verify your number on xxx app is 9644
it was not able to pick it up.
I have also attached a screen recording with this comment.
Thank you
https://user-images.githubusercontent.com/34997841/176832849-4855595b-f110-43a7-90eb-2f5522c0e0b4.mp4
Hi @pranjalpc99 I believe this issue is out of my packages scope, could your try if the same happens for pure TextField
? If yes, then you should also create an issue on Flutter repository.
Why I think so is that, I'm not doing anything for SMS autofill on WEB, it works out of the box.
I think the SMS code must follow some standards, which is not specified anywhere I looked for 😢, I saw some people have problems with other languages (Spanish). If you find anything helpful please share with us.
Hi @Tkko Yes, there is some kind of SMS format that iOS uses which is not documented anywhere sadly 😢.
From my observation the format should be like the following:
- Code is 123456
- OTP is 123456
- code: 123456 etc.
Hi @Tkko Yes, there is some kind of SMS format that iOS uses which is not documented anywhere sadly 😢.
From my observation the format should be like the following:
1. Code is 123456 2. OTP is 123456 3. code: 123456 etc.
True. Is there a work around for this?
Hi @Tkko Yes, there is some kind of SMS format that iOS uses which is not documented anywhere sadly 😢. From my observation the format should be like the following:
1. Code is 123456 2. OTP is 123456 3. code: 123456 etc.
True. Is there a work around for this?
Nothing that I know
Closing this issue, feel free to reopen it if you need to.
I need to open it @Tkko because I have problem with iOS release or debug version.
Here are my codes, that does not understand the coming OTP code: (Also the code coming as 0000 is your verification code)
Pinput(
keyboardType: TextInputType.phone,
androidSmsAutofillMethod: AndroidSmsAutofillMethod.smsUserConsentApi,
autofocus: true,
length: 4,
controller: pinPutFieldController,
onChanged: (value) {
context.read<AuthBloc>().add(ChangeOTPCodeEvent(value));
},
defaultPinTheme: PinTheme(
width: 56,
height: 56,
textStyle: const TextStyle(
fontSize: 24,
color: blackColor,
fontWeight: FontWeight.w400,
),
decoration: BoxDecoration(
color: whiteColor,
border: Border.all(color: kafileGreen),
borderRadius: BorderRadius.circular(8),
),
),
),
Hi @alperefesahin, to double check your issue, the code ins't showing on top of the keyboard, right?
Yes @Tkko, right
Temporarily replace Pinput
with TextField
and check if autofill works fine
@Tkko it does not work also for TextField
or TextFormField
@alperefesahin Try to change SMS code to your verification code is 000000
Tried, but still does not work for pinput and textfield @Tkko
also tried it on android, and it works well, but on the other hand, iOS has a problem with getting the sms automatically. The incoming text like, Your verification code 0000, you can use it etc. @Tkko
@alperefesahin SMS text guideline is not clear but what mentioned should work fine. Is the SMS text in English? If not it might be the issue.
@Tkko the text is the Turkish language based, and unfortunately can't be changed. As I said, it works on Android as well, but for the iOS side, you said that the problem is related to "Language of the incoming text", right?
Yeah that's correct. Apple also supports domain based verification so that should work https://developer.apple.com/news/?id=z0i801mg