Open openradar-mirror opened 7 years ago
@openradar-mirror Facing the same issue here. Did you get any solution for it ? It will be helpful if you can post the solution too. Thanks.
Worked around it by returning true for single space replacement when textField.text is empty.
Description
Summary: I have a UITextField, it's textContentType is set to UITextContentType.emailAddress and when the field is selected, email addresses are properly shown above the keyboard. However I have a limited set of characters allowed in this UITextField and that is gated by the textfield's delegate implementing textField:shouldChangeCharacterIn:replacementString. One of those invalid characters is a space.
Unfortunately, when tapping the suggested email address above the keyboard, the replacementString sent to the delegate function is " " and not "the@email.address". Also what is finally inserted is "the@email.address " with a trailing space at the end. This functionality makes it challenging to validate input and also erroneously inserts spaces after an email address in a field designated only for email addresses.
Steps to Reproduce:
Expected Results: Should receive the actual email address in the delegate function without a trailing space.
Observed Results: The delegate function is told that a single space is attempting to be inserted, then if it returns true, the email address plus a space is inserted, if it returns false, nothing is inserted.
Version: iOS 11, Beta 4
Notes:
Configuration: Tested so far on an iPad Air 2 and an iPhone 6s Plus running iOS 11 beta.
- Product Version: iOS 11 Beta 4 Created: 2017-07-31T21:50:32.771510 Originated: 2017-07-31T00:00:00 Open Radar Link: http://www.openradar.me/33634848