Search code examples
ioscustom-keyboarduikeyboardtype

iOS Custom Keyboard Types


I'm worked on a custom keyboard and Apple review team rejected it because the keyboard does not support 'Numbers and Decimals' types.

So, I found that the problem is that when a text field requires those specific type of keyboard (for example to inset age, measures, or other numeric values), my keyboard 'misses to respond'.

I understood, reading from Apple documentation, that you must respond to the UIKeyboardTpye property per text object's.

I searched for specific delegate of the UIInputViewController but I wasn't able to find something close to that.

In this forum I found that one good place to examine the current keyboard type required is the textDidChange: delegate, but, it is not called.

I suppose this responder is called when your keyboard, somehow, 'declares' to iOS that it can handle Numbers or Decimal types. In fact I created a simple app with a simple UITextView that requires the Decimal keyboard type:

textView.keyboardType = UIKeyboardTypeDecimalPad;

And I put a NSLog() in the keyboard extension Input View Controller textDidChange: delegate.

As I tap on the text view my delegate is not called, instead the standard Decimal keypad is shown and in the Xcode console I see the following message:

Can't find keyplane that supports type 8 for keyboard iPhone-Portrait-DecimalPad; using 405786210_Portrait_iPhone-Simple-Pad_Default

I noticed also that this message comes when the UITextView requires the not-allowed keyboard types, i.e. the phonepad. All other keyboard types do not issue that message and the custom keyboard is shown and the textDidChange: delegate is correctly called.

The Numbers and Decimal types are surely allowed and are a MUST for the review team guys. Why the behave as a forbidden-types?

I think we need to 'declare', for example in the info.plist that our extension supports various keyboard types, but... well or more simply... I do not get the point... so... I'm asking... How can I add multiple keyboard types to my keyboard extension??

Thank you very much for help!


Solution

  • After the second rejection of my keyboard extension they sent me a screenshot. I noticed that they, generally, test apps on iPad. This made me think.

    After some test it came out that the Numbers and Decimal types do not respond the same way on iPhone and iPad.

    On iPhone a text view requiring Numbers or Decimal type keyboard always shows the iOS keypad, i.e. the custom extension is not called.

    On the other side, on the iPad a text view requiring Numbers or Decimal type keyboard activates the custom extension.

    Finally, after provided a standard numeric keypad (even if my keyboard uses hand-written techniquies) it was approved.