Flutter_Pinput icon indicating copy to clipboard operation
Flutter_Pinput copied to clipboard

iOS sms auto fill not working

Open Ibrokihimbek opened this issue 2 years ago • 24 comments
trafficstars

Hello, I have a problem

that is, sms autofill is not working, there is no problem on android, on android, sms is coming and it asks for permission to enter the code in the sms, but on iOS, sms is coming, but it doesn't ask for permission to write, and it doesn't write the code automatically

Ibrokihimbek avatar May 29 '23 09:05 Ibrokihimbek

Hey, that's how iOS auto fill works by default (by tapping sms code on top of the keyboard). But you can also configure a trusted domain and enter code automatically.

https://github.com/Tkko/Flutter_Pinput/issues/132

Tkko avatar May 29 '23 09:05 Tkko

On iOS 16 the sms autofill is not showing on top of keyboard. It used to work. But not anymore. The sms-code is received but pinput does not display it to choose.

janlektonen avatar Jun 15 '23 08:06 janlektonen

@janlektonen Have you changed anything on your side? Is sms content same?

Tkko avatar Jun 15 '23 10:06 Tkko

@Tkko No nothing changed, same sms content with 6 digits to input from sms. But it's strange it's stopped working. As I understand I don't need to change/do anything on iOS, only on Adroid right?

janlektonen avatar Jun 15 '23 11:06 janlektonen

Yeah, iOS autofill works fine out of the box, standard TextField has autofill too, speaking of which, can you replace Pinput with TextField and check if it's working properly?

Tkko avatar Jun 15 '23 11:06 Tkko

I have tried again also with TextField on iOS 16.5.1. It can't get it to work and show sms code when clicking in the input field. I also see there is a new_pinput package in pub.dev: https://pub.dev/packages/new_pinput Something you know about @Tkko ?

janlektonen avatar Jul 06 '23 07:07 janlektonen

Hey @janlektonen, could you send me the example of SMS you are receiving? I'm not aware of new_pinput, I don't see any improvements an author made, it's just a clone so far.

Tkko avatar Jul 07 '23 06:07 Tkko

Hey @Tkko, it is just a normal Firebase push notification. I don't have any data on it. But the keyboard input don't pick the FCM up. Maybe its because its from Firebase and not a normal sms.

Here is the documentation on what I receive: https://firebase.google.com/docs/cloud-messaging/concept-options

janlektonen avatar Jul 07 '23 07:07 janlektonen

Yeah, it should be an SMS but as a workaround you can read the push notification content in your app and set the code programmatically

controller.setText(codeFromPushNotification);

Tkko avatar Jul 07 '23 08:07 Tkko

Thanks, I will do that then!

janlektonen avatar Jul 07 '23 09:07 janlektonen

@Tkko - sms autofill not working in ios with latest IOS its working in older version. any Idea what need to do this fix.

mobikodeStudio avatar Jul 24 '23 06:07 mobikodeStudio

@janlektonen There are message patterns for autofill to work on iOS, such as:

Verification code: 123456

Please check this message pattern example and update us.

@Tkko Add this info to your documentation, please.

DeveloperEC1 avatar Sep 27 '23 13:09 DeveloperEC1

Hi @DeveloperEC1 @Tkko

Using Pinput() I cant get it working. I have tried this:

autofillHints: [AutofillHints.oneTimeCode], // ios autofill on push

But it is not working. Should it not support autofillHints on ios?

janlektonen avatar Sep 28 '23 10:09 janlektonen

@janlektonen You need to press on the top of your keyboard when the SMS is received if you use the SMS format for iOS, this is the Autofill in iOS.

DeveloperEC1 avatar Sep 28 '23 10:09 DeveloperEC1

@DeveloperEC1 Yes I know that there is shown a line on top of keyboard with the code and you should click there to get it into pinput.

BUT - that line is not shown anymore. It stopped working some version-updates ago. I pointed that out earlier this year. So something changed in your code/package I guess or iOS 16 changed something or maybe Flutter SDK?

But the the OTP code is not shown anymore on top of keyboard for Firebase Push one time code notifications. It used to work earlier this year in your package.. but stopped. I think this is what people are pointing out here.

janlektonen avatar Sep 29 '23 11:09 janlektonen

Any update about line under keyboard? Because still doesn't work. Should I change any perm or stuf in iOS or Xcode or in project. @janlektonen @Tkko @Ibrokihimbek

Android is working.

abdullahonus avatar Mar 15 '24 14:03 abdullahonus

@abdullahonus I have tried and just tested again on real ios 17 device. It's not working on ios...

janlektonen avatar Mar 16 '24 12:03 janlektonen

@janlektonen thank you for feed back. Can @Tkko do anything about that pleas?

abdullahonus avatar Mar 18 '24 07:03 abdullahonus

@janlektonen or any suggest from you I can try

abdullahonus avatar Mar 18 '24 07:03 abdullahonus

@abdullahonus as long as you followed the guidelines here I'm not sure we can do anything else? https://pub.dev/packages/pinput#sms-autofill

The documentation says it should be working - but I just can't get it working on a real ios device for months now...

janlektonen avatar Mar 18 '24 08:03 janlektonen

@janlektonen got it . So still not working we should wait for refactoring the code :/ Also thank you for ur information Mr. Jan

abdullahonus avatar Mar 18 '24 08:03 abdullahonus

Hey guys, I've just checked autofill on iOS 17.3.1 with Flutter 3.19.3 and when I send this SMS to my phone number the code is showing up on a keyboard.

My SMS looks like this "Hey, your sms code ie 4432"

If you are sending SMS in different language iOS might not be able to read the OTP so try to send it in English.

Please tell me, If there is anything you are doing differently.

Tkko avatar Mar 18 '24 09:03 Tkko

@Tkko i can inform you that I use the Danish language template in Firebase for the sms message. Is there a way for the code to pick up the Danish language?

janlektonen avatar Mar 18 '24 09:03 janlektonen

I can't really find an exact SMS guidelines for iOS and it is a common issue but if you include the word "code" in your SMS it seems to be working fine.

We had a same issue before so I recommend to read it as well https://github.com/Tkko/Flutter_Pinput/issues/85

Again, the issue isn't related to Flutter, that's how it works on iOS.

Tkko avatar Mar 18 '24 09:03 Tkko