5

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 field on my login page works perfectly fine (the auto-login with saved password even works and I didn't do anything to get this working), but on my register page, the field makes my keyboard switch from AZERTY to QWERTY.

There is just the AZERTY keyboard in my phone settings, and it happens with all the iOS 12 devices not just mine...

The only thing I do in code : (my UIView file is named RegisterView.swift)

fieldPwd = UITextField()
fieldPwdConfirm = UITextField()
fieldPwd.isSecureTextEntry = true
fieldPwdConfirm.isSecureTextEntry = true

Is there any fix to this issue ? Thanks !

Quentin Rth
  • 178
  • 1
  • 15
  • Possible duplicate of [How to show specific language keyboard when user input values in UITextField in iPhone App?](https://stackoverflow.com/questions/28318076/how-to-show-specific-language-keyboard-when-user-input-values-in-uitextfield-in) – Maximelc Oct 26 '18 at 08:03
  • Nop but thanks anyway. This topic is mostly for iOS 12 because this issue appears only on iOS 12, hope we'll find a fix so it could help other people – Quentin Rth Oct 26 '18 at 08:18
  • 2
    This seems to be a known problem; https://stackoverflow.com/questions/52701160/native-uitextfield-secure-text-entry-forces-english-us-keyboard. I suggest you file a big report with Apple. – Paulw11 Oct 26 '18 at 12:13
  • Thanks @Paulw11, I searched but didn't find this ! Hope Apple will fix that soon... – Quentin Rth Oct 26 '18 at 12:56
  • Have you found a solution to this problem ? – Martin Dec 13 '18 at 10:32

4 Answers4

2

I've found a solution for my project, maybe it can help someone.

I've noticed that :

  • in my login page (with 1 secure UITextField), keyboard was AZERTY
  • in my signin page (with 2 secure UITextField), keyboards were QWERTY
  • in my account page (with 2 secure UITextField), keyboards were AZERTY

After 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
}

@.@

pyonpyon
  • 66
  • 9
1

This is because of the app default region setting. Remove below setting from info.plist.

<dict>
   <key>CFBundleDevelopmentRegion</key>
   <string>fr</string>
   ...
</dict>

Cheers...

Rajesh Maurya
  • 3,026
  • 4
  • 19
  • 37
0

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.

Aurelien
  • 141
  • 4
  • Doesn't work for me, even with textfield type "new password" or "unspecified" I get a qwerty field. The only way to get my azerty keyboard back on this field is with "secure text entry" feature off. – Quentin Rth Jul 23 '20 at 08:48
  • Update: With "Secure text entry" off and content type "new password/password" I get the same issue (and with a clear password) – Quentin Rth Jul 23 '20 at 08:51
  • Well I guess the issue resides elsewhere as it's enough for me to have the keyboard in AZERTY while still enabling the Secure Text Entry property. And no keyboard flickering while switching from one textField to the other. Most of the textFields properties are set to Default in IB (except for Correction and Spell Checking which are set to No and Capitalization which is set to None). Both "New Password" textFields are in the same stackView. And my device (iPhone 8, iOS 13.5.1) is using the French language too. – Aurelien Jul 24 '20 at 09:20
0

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
}
  • not working
  • not removing the warning "Cannot show Automatic Strong Passwords for app..."

Idea #3 remove CFBundleDevelopmentRegion

  • not working

Idea #4 entend UITextField, override textInputMode return one with the correct lang similar to here: https://stackoverflow.com/a/52701639

  • not working

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!

Prakash Shaiva
  • 1,047
  • 8
  • 12
bobln
  • 41
  • 1