braintree / braintree-ios-drop-in

Braintree Drop-in for iOS
https://developers.braintreepayments.com
MIT License
100 stars 79 forks source link

Cannot write CC expiration date from Simulator running on a Intel based Mac #415

Open lechuckcaptain opened 1 year ago

lechuckcaptain commented 1 year ago

Braintree Drop-in SDK Version

9.8.2

Environment

Sandbox

Xcode Version

14.3.1

OS Version & Device

iPhone 14 PRO - iOS 16.4 Simulator

Integration type

Swfit Package Manager

Development Processor

Intel

Describe the bug

It seems that on a iOS simulator run on an Intel based Mac it's not possible to correctly enter the credit card expiration date. Only the first char gets displayed and no other characters are accepted. It seems that sometime, as a workaround, it's possible to paste the expiration date string value from the clipboard and it gets accepted.

From an Arm based Mac everything seems to work without any issue.

To reproduce

Expected behavior

It should be possible to manually enter the credit card expiration date also on a iOS simulator run on Intel based Mac.

Screenshots

https://github.com/braintree/braintree-ios-drop-in/assets/341895/453d49b9-75b3-44b7-8c67-b7e04d70edb7

scannillo commented 1 year ago

👋 Hi @lechuckcaptain - thank you for opening this issue and for the thorough details + video! We will test on an Intel Mac to see if we can replicate and get back to you.

lechuckcaptain commented 1 year ago

👋 Hi @scannillo, thank you for the answer. Please let me know if you need any support troubleshooting the issue.

via-guy commented 1 year ago

@scannillo we're having this issue too using the iOS 16.4 or later. It doesn't happen to us on a simulator running iOS 16.2 or earlier. We're actually using BraintreeDropIn/UIKit (8.2.0), but we see the same issue, and it's clearly coming from different versions of iOS. This is what happens when you hack internal implementations of Apple's SDKs...

via-guy commented 1 year ago

We resolved the issue by not using the editDelegate to check for when backspace was pressed. Instead in textField(_:shouldChangeCharactersIn:replacementString:) we check string.isEmpty && range.length > 0 to see if the user is deleting a character and pass that into BTUIKCardExpiryFormat.backspace.

lechuckcaptain commented 1 year ago

Hey @scannillo, sorry to bother you, do you have any updates on this issue?

scannillo commented 1 year ago

👋 Hi @lechuckcaptain - did you try the new Xcode 15 beta?

lechuckcaptain commented 1 year ago

Hey @scannillo, on the latest Xcode 15 beta 6 with default iOS simulator (iPhone 14 Pro iOS 17.0) the issue is still present 😢

https://github.com/braintree/braintree-ios-drop-in/assets/341895/8ecc99fa-3bc1-481a-806a-5f1112264f8f

scannillo commented 1 year ago

I created a ticket with our team for this (DTBTSDK-2913 for tracking). However to be honest, since this only happens Intel simulators and not Apple Silicon machines (sounds like an Xcode bug) or real devices, there are many other tasks on our roadmap that have to take priority over this one right now.

We do welcome PRs though if you have the time to take a look!