Custom input method app is added to Keyboard Input selector hundreds of times. [`NumberInput` sample code]

Originator:peter.kamb
Number:rdar://21376114 Date Originated:June 14 2015
Status: Resolved:
Product: Product Version:
Classification: Reproducible:
 
Summary:
Custom input method app is added to Input selector hundreds of times.

I've downloaded and run the NumberInput sample code for Input Method Kit.

I've tried moving the built NumberInput.app to both `/System/Input Methods/` and `~/System/Input Methods/`.

After enabling the NumberInput method in System Prefs > Keyboards, everything appears to work fine. One menu item is added to my Input picker in the menubar, etc.

However, I soon return to the Input menubar item and am overwhelmed by tens or hundreds of menu items for "NumberInput". See pics.

These are also visible in the System Prefs > Keyboards menu.

I'm not sure what is triggering this duplication.

I am sometimes able to delete them, sometimes not. They come back. 

This makes it extremely hard to work with Input Method Kit. I'm never sure which is the actual app I'm developing, which is an old copy, etc.

Please see pictures. Let me know if you need any additional information.

Steps to Reproduce:


Expected Results:
The input method should only appear once.

Actual Results:
Input method appears hundreds of times. Unable to know which is the "real" one under development, etc.

Version:
OS X 10.10.3
Using the sample code "NumberInput" in the "step 0" do-nothing version.

Notes:


Configuration:

Comments

IMAGE: https://i.imgur.com/2nKYpg9.png

By peter.kamb at Aug. 3, 2018, 10:47 p.m. (reply...)

Ok, good to know about the duplicated bundle IDs. I'll make sure not to put the same app in both locations. That was just due to testing where to put the input method, not a particular need to have it in both locations.

Regardless, It probably shouldn't create this issue with hundreds of the same input name :)

Thanks for the tips on input method development, very helpful.

By peter.kamb at March 24, 2018, 8:34 p.m. (reply...)

Apple Developer Relations

Engineering has provided the following feedback regarding this issue:

If you are laying down 2 copies of NumberInput IM in both /Library/Input Methods/ & ~/Library/Input Methods/, with both having the same bundleID, that is undefined behavior. Probably you should make them distinct IMs, but I’m unclear why you would want both for Dev purposes. And a logout after installing an InputMethod is standard procedure.

However, for Development, I routinely ‘ditto’ my build/Debug bits into the InputMethod:

$ sudo ditto ./build/Debug/NumberInput.app /Library/Input\ Methods/NumberInput.app
$ killall -9 NumberInput
# -9 (SIGKILL)

-9 SIGKILL is required, otherwise running apps will refuse to talk to your input method, considering it to have died “abnormally”.

You’ve probably figured out that InputMethod development is easiest with a 2nd machine for remote debugging (I use LLDB), rather than inside Xcode on the same machine.

Please let us know whether the issue is resolved for you by updating your bug report.

By peter.kamb at March 24, 2018, 8:33 p.m. (reply...)

Ah, yes, I meant Library > InputMethods rather than System.

I just reproduced this on a new account:

  1. There's an existing NumberInput.app in in /Library/Input Methods
  2. Create a new “keyboardtest” OS X user.
  3. Activate the System version of NumberInput on keyboardtest via System prefs.
  4. Switch back to main OS X account. Build new version of NumberInput.app via Xcode. Put in Shared folder.
  5. Switch to keyboardtest user. Grab new version of app. Move to ~/Library/Input Methods.
  6. Open Keyboard prefs. See two "NumberInput" input methods in sidebar.
  7. Hit input method "+" button. See tens of "Number Input" methods. Greyed out.
  8. Close System Prefs. Open System Prefs > Keyboards.
  9. Now the tens/hundreds of "NumberInput" methods are in the active sidebar, as well as the "+" menu. See pic.

Yes, logging out of the "keyboardtest" account and then logging back in immediately fixes the issue. I have not tested to see if I can trigger it again using that user account.

By peter.kamb at March 24, 2018, 8:33 p.m. (reply...)

Apple Developer Relations

We need more information to investigate this issue.

/System/Input Methods/ and ~/System/Input Methods/ You mean /Library/InputMethods/ or ~/Library/Input Methods/, correct?

Does it fix itself after logout/restart?

Please provide your response or results by updating your bug report.

By peter.kamb at March 24, 2018, 8:32 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!