intl_phone_number_input
intl_phone_number_input copied to clipboard
Problem: The number input field on IOS add also the country code
For example: Number is : 9295522887 initialValue: PhoneNumber(phoneNumber: "9295522887", isoCode: "US");
On Android: 1+ | (929) 552-2887
On IOS: 1+ | 1+ (929) 552-2887
Why there is a difference between them? Is it a known problem?
I have the same problem. On getRegionInfoFromPhoneNumber has flutter: PlatformException(1, The country code is invalid., null, null) on iOS. On Android works fine.
I have both problems
Having the same issue :(
Having the same issue too
Having the same issue
Having the same issue
Having the same issue
Any update?
I have the same issue with the latest version
Nobody seems to care about this problem.
@emillenard Sorry, I'll look into the issue today and see if I can get @natintosh to push some fixes out on this and other issues. Meanwhile, fixes PRs will be welcomed if anyone can help with fixing some of the issues created.
@bynalab thanks, i found the problem, is in phone_number.dart the regionInfo.regionPrefix is the same with regionInfo.isoCode on iOS.
@bynalab thanks, i found the problem, is in phone_number.dart the regionInfo.regionPrefix is the same with regionInfo.isoCode on iOS.
Do you have any solution?
The quiq fix for me was to change in library:
Changes in: input_widget.dart line 184 From: "String phoneNumber = await PhoneNumber.getParsableNumber(widget.initialValue!);" To: "String phoneNumber = widget.initialValue!.parseNumber();"
Changes in: SwiftLibphonenumberPlugin.swift line 81 From: "let countryCode: String? = phoneNumberKit.mainCountry(forCode: p.countryCode)" To: "let countryCode = "+" + String(p.countryCode)" line 77: From: "let p: PhoneNumber = try phoneNumberKit.parse(phoneNumber, withRegion: isoCode.uppercased(), ignoreType: true)" To:" let p: PhoneNumber = try phoneNumberKit.parse(phoneNumber)"
@emillenard SwiftLibphonenumberPlugin.swift where is this file located
@emillenard @hrishikeshpujari1902 How to apply the fix the the swift file? Where is it? We need urgent fix in production. Is there a previous version which works fine?
@natintosh @bynalab Is there a workaround to be had? Will appreciate a fix for this ASAP!
@emillenard @hrishikeshpujari1902 How to apply the fix the the swift file? Where is it? We need urgent fix in production. Is there a previous version which works fine? @hrishikeshpujari1902
hi, is not the best approach, but for quick fix to production until will be ok in library i changed the file from Pods , you will find the SwiftLibphonenumberPlugin.swift in Xcode on Pods/PhonKitNumber folder , change it and then compile the version.
@tigrenok00 Do these changes in the local pub cache as a temporary fix. It will not format the number like added spaces in between but it wont add the extra country code as well. Changes in: input_widget.dart line 184 From: "String phoneNumber = await PhoneNumber.getParsableNumber(widget.initialValue!);" To: "String phoneNumber = widget.initialValue!.parseNumber();"
I got same errors as above. can someone explain why this happens? Because I did not upgrade the package, still in version 0.7.0+2 since the first day, and now it suddenly breaks. Thanks
@emillenard @hrishikeshpujari1902 How to apply the fix the the swift file? Where is it? We need urgent fix in production. Is there a previous version which works fine? @hrishikeshpujari1902
hi, is not the best approach, but for quick fix to production until will be ok in library i changed the file from Pods , you will find the SwiftLibphonenumberPlugin.swift in Xcode on Pods/PhonKitNumber folder , change it and then compile the version.
can you explain clearly what you did exactly ?
For fix use older version dependency
dependency_overrides: libphonenumber_plugin: 0.2.3
+1
For fix use older version dependency
dependency_overrides: libphonenumber_plugin: 0.2.3
This worked for our project, thank you
Flutter 2.8.1
intl_phone_number_input 0.7.0+2
libphonenumber_plugin 0.2.3
(downgraded from 0.2.5)
For fix use older version dependency
dependency_overrides: libphonenumber_plugin: 0.2.3
This does not sounds like a long-term fix since we would be stuck with the old dependency and its transitive dependencies. Is there a better way to solve this issue or should we just wait for the next libphonenumber_plugin version?