Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrecognized selector crash in PhoneNumberTextField #82

Closed
jrogers opened this issue Oct 27, 2016 · 0 comments
Closed

Unrecognized selector crash in PhoneNumberTextField #82

jrogers opened this issue Oct 27, 2016 · 0 comments

Comments

@jrogers
Copy link
Contributor

jrogers commented Oct 27, 2016

Getting this crash on line 175 in TextField.swift in my app, happens with both 4.0.7 and latest master:

2016-10-26 17:33:30.128587 App[535:69350] -[App.LoginViewController textField:shouldChangeCharactersInRange:replacementString:]: unrecognized selector sent to instance 0x10383aa30
2016-10-26 17:33:30.129487 App[535:69350] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[App.LoginViewController textField:shouldChangeCharactersInRange:replacementString:]: unrecognized selector sent to instance 0x10383aa30'

        guard _delegate?.textField!(textField, shouldChangeCharactersIn: range, replacementString: string) ?? true else {
            return false
        }

If I change it to check textField(), it works:

        guard _delegate?.textField?(textField, shouldChangeCharactersIn: range, replacementString: string) ?? true else {
            return false
        }

Not really sure what the root cause is as it looks like the delegate should be referencing PhoneNumberTextField as the UITextFieldDelegate, but this was a recent change and the code looked like the change I made before efb636b.

This is with Xcode 8.1 GM, on iOS 10.1 device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant