UIPickerview as inputview to UITextfield shows weird behavior - shows Keyboard instead of picker selection for working code

I have a working code with more than 20 view controllers. Where I used UIPickerView as input view to UITextField which is populated on a network call. The application was tested locally using .ipa file as well as directly installing through Xcode for couple of iterations. Everything was working fine so far.


But all of a sudden started seeing a weird behavior, Keyboard is showing when I tap on the text field instead of Picker selection.

This issue is happening only for few view controllers where it was working fine earlier. Similar implementation is still working fine for most of the view controllers.

I tried almost all the possibilities including redesigning the page and is working fine on simulator/iPhone when I directly install/run through Xcode.

But when I create an IPA file, still seeing the same issue (i.e. not seeing the picker selection)


I am using Xcode 10.3.


While debugging noticed control is not going to textFieldDidBeginEditing() at all in failed scenarios.

I am completely stuck. Not sure why all of a sudden the working code is broken.


Any direction to fix the issue is much appreciated.

Accepted Reply

No, I don't remember similar issue.


Sometimes, the changes made are not taken immediately into account (a lot of caching by XCode in many places). Just make changes, wait… some time…and suddenly it works.


Computer science is not yet an exact science… 😉


Anyway, great that it works. I advise you to write down the maximum memories of the incident, what you observed exactly, what you tried, what you changed… That may help you in the future.


And make an immediate copy of the working full project.


Don't forget to close the thread now.

Replies

With that picker view displayed on the screen successfully but again textDidBeginEditing() is not invoked where we set the activeTextField.


So, this delegate func is not called at all ?

Did you insert a log (write this to a temporary label to insert in view) to test inputView ?


The only reason I can think of is that textField.inputView is nil for whatever reason.

Should check this first, then, if so, we'll try to find why.

So, this delegate func is not called at all ?

Did you insert a log (write this to a temporary label to insert in view) to test inputView ?


textDidBeginEditing is not called at all.

I have added a logging statement inside textDidBeginEditing() to print the inputview which didn't execute.

Maybe in this conf (release, ipa) print does not print.


That's why I proposed to print this in a temporary label in the view.


How are you sure textDidBeginEditing is not called at all ?

How are you sure textDidBeginEditing is not called at all ?

console log didn't print for me.


Now I am not able to recreate the issue in the release scheme. Now it's working as expected.

Not sure how it got fixed. maybe switching between schemes?


Have you ever faced similar issues in the past due to any scheme/target issues?

No, I don't remember similar issue.


Sometimes, the changes made are not taken immediately into account (a lot of caching by XCode in many places). Just make changes, wait… some time…and suddenly it works.


Computer science is not yet an exact science… 😉


Anyway, great that it works. I advise you to write down the maximum memories of the incident, what you observed exactly, what you tried, what you changed… That may help you in the future.


And make an immediate copy of the working full project.


Don't forget to close the thread now.

Thanks, Claude for your help.