I code an iOS
App in Swift 4
, I\'m french so I work with mobile phone in french language/french region.
With an iOS 12 device, my password
I've found a solution for my project, maybe it can help someone.
I've noticed that :
UITextField
), keyboard was AZERTYUITextField
), keyboards were QWERTYUITextField
), keyboards were AZERTYAfter a while of comparison between signin and account pages, I've realized that in my account page, the textfield before secure textfield was a .numberPad
textfield.
So in my login xib file, I've set my secure textfields to .numberPad
and I set them to .default
in textFieldDidBeginEditing
. And back to .numberPad
again in textFieldDidEndEditing
because if not, keyboards appeared in QWERTY the second time. Now, my secure textfields are in AZERTY.
func textFieldDidBeginEditing(_ textField: UITextField) {
if ( textField == pwdTextField || textField == pwd2TextField ) {
textField.keyboardType = .default;
}
// do other stuffs
}
func textFieldDidEndEditing(_ textField: UITextField) {
if ( textField == pwdTextField || textField == pwd2TextField ) {
textField.keyboardType = .numberPad;
}
// do other stuffs
}
@.@
Same Issue here: https://github.com/xlbs-rm/ios-demo
Filled a Bug Report here: https://feedbackassistant.apple.com/ Date 2020-07-31
No Reaction from Apple yet Issue on iOS 13.5.1, 13.7, 12.4.3 Issue on Connected Device (Debugging), Simulator, TestFlight Alpha Builds (for iTunesConnect Users), TestFlight Beta Builds (Apple Approved TestFlight Builds)
Only Solution is remove the 2nd Password Field!
Idea #2 textContentType = .oneTimeCode suggested here: https://stackoverflow.com/a/53760545
if #available(iOS 12.0, *) {
tfPassword.textContentType = .oneTimeCode
}
Idea #3 remove CFBundleDevelopmentRegion
Idea #4 entend UITextField, override textInputMode return one with the correct lang similar to here: https://stackoverflow.com/a/52701639
Solution:
if #available(iOS 12.0, *) {
passInput.textContentType = .newPassword
}
Implement: UITextFieldDelegate
public func textFieldDidBeginEditing(_ textField: UITextField) {
if exchangeResponder == false {
exchangeResponder = true
firstnameInput.becomeFirstResponder()
textField.becomeFirstResponder()
exchangeResponder = false
}
}
passInput.delegate = self
pass2Input.delegate = self
Now I can move between all fields and have everytime the German keyboard!
This is because of the app default region setting. Remove below setting from info.plist.
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>fr</string>
...
</dict>
Cheers...
Indeed, using 2 password content-type textfields (when the user has to confirm a new password for instance) creates issues with the keyboard. As stated here, the keyboard is set to QWERTY whereas it should be in AZERTY (with the language I use) and when I go from one textfield to the other, the keyboard blinks.
Actually, there's no need to set this content-type for password textfields, using "New password" content-type for both textfields works just fine and creates no issue with the keyboard.