marmelroy / PhoneNumberKit

A Swift framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber.
MIT License
5.13k stars 817 forks source link

Conflict with GooglePlacesAutocomplete #11

Closed Treverr closed 8 years ago

Treverr commented 8 years ago

It seems when this is imported, the entire application can no longer use search bars.

marmelroy commented 8 years ago

I've been looking into this and can't seem to replicate. Can you share some code that shows the conflict?

Treverr commented 8 years ago

It looks like its mostly affecting the UISearchBar in GooglePlacesAutocomplete. It did affect mine in my customer tableview but it seems to be working now, but I'm not quite sure why it affects that one only.

Treverr commented 8 years ago

If you'd like to look at the issue, https://github.com/Treverr/inSparkle/tree/PhoneNumberKitIssue11

If you type in the Phone Number field, it causes the issue and I'm not sure why. Maybe its just me. But it also causes a crash when closing out the Adding screen. Though no reason in the debugger.

If i don't type into the phone number field where it would be formatting, then it works fine.

Simulate into the Screens as follows and you'll see the issue, Schedule -> + -> Opening -> Mag glass next to Customer Name -> Add Customer -> tap address cell

marmelroy commented 8 years ago

Thanks @Treverr, just had a quick look...

The issue was that you returned false on func textFieldShouldEndEditing(textField: UITextField)

It meant that the phone number text field would never finish editing.

Additionally, checking which field is in the textfield delegate with an .isFirstResponder() is wrong because it might have already lost the firstResponder status. Check which one it is with an if statementt instead.

I made a pull request on your project that fixes it: https://github.com/Treverr/inSparkle/pull/37

Treverr commented 8 years ago

Awesome, thanks for the word of advice! Im newer to this all still so I really appreciate it!

marmelroy commented 8 years ago

No worries :smile: