needsInputModeSwitchKey returns false on iPhone X in compatibility app

When needsInputModeSwitchKey is false, your custom keyboard is supposed to hide the 'switch keyboard' button. This is false on iPhone X because the globe button is provided by the system. However it is also false when running an app in compatibility mode - not optimized for iPhone X - and here it falls back to the non-iPhone X keyboard inside the compatibility window. This results in there being no globe key visible, it's impossible to switch keyboards.


I filed this bug report: rdar://35549038


Are there any workarounds? Any suggestions, other than show the duplicate globe button for iPhone X until this issue is addressed?


The issue continues to occur with iOS 11.2 beta 3. When can we expect this to be fixed?

Accepted Reply

This issue has been resolved in iOS 12 beta 1.

Replies

I have the same problem. Haven't found a workaround yet. Please provide the solution if you ever found one.

Does anyone solve this or any other workaround?

I've run into the same problem. Any updates on your bug report?


I wasn't able to successfully find a way to detect compatibility mode for a workaround, so I'm just going to go ahead and display my switch key unconditionally. I'd much rather have a redundant switch key hanging out than leave users without a way to switch the keyboard. Bummer.

Also, the system-provided keyboards seem to handle compatibility mode just fine, so clearly the problem is solvable...

No update. No known workarounds from me either. Quite the bummer for sure.

Exactly. I have filed a bug report since the iPhone X release. No one seems to care. The status has not changed at all. 😠

The issue still exists on iOS 11.3 Beta 3.

is there any news on this?

This issue has been resolved in iOS 12 beta 1.

ugh, ok, thank you for the info!

too bad, though, that it'll remain in iOS 11...


thanks again, Jordan, much appreciated!

You're welcome. Nice thing is every iOS 11 user can update to iOS 12.

And it's broken in iOS 12.0, at least in the XS and X simulators.

I think it has not been resolved or there is a similar bug. What I've found is that it also returns false for needsInputModeSwitchKey for text fields with UIKeyboardType set to UIKeyboardTypeNumberPad and UIKeyboardTypePhonePad.


Only changing PrimaryLanguage key in Info.plist of Keyboard Extension from en-US to mul resolved the issue for my app. So it automatically switches to system keyboard for these UIKeyboardType types from now.

For anyone still searching on this particular issue: for iPhone (X, Xr, Xs), needsInputModeSwitchKey reports 'true' in viewDidLoad, then becomes 'false' in viewWillAppear. This still seems like a bug to me, but I am not sure at what point variables are guaranteed to be initialized.