Still playing with OS X Touchbar, I am hitting a thick wall: the 10.2.1 Release Notes read:

NSTouchBar supports a text-related item identifier, NSTouchBarItemIdentifierCharacterPicker, and returns an NSPopoverTouchBarItem configured to show the system character picker from -itemForIdentifier:.

That Character Picker (that is more an Emoji Picker) is easily visible for instance with a Compose Window of Apple Mail:

Touchbar for Apple Mail's compose window

You can see there, from right to left, a scrubber with the most frequently used emojis, a label, and a popover button that allows access to the various categories of emojis and their contents. All in all, it's very well done.

But if I try to programmatically add a NSTouchBarItemIdentifierCharacterPicker to a touchbar that is not linked to a NSTextView or a NSTextField, I end up with a horked, partial, result. The popover button is correct but when you click on it...

Horked touchbar when created programatically

As you can see, there is only the list of favorites emojis (in fact the last used emojis), it does not scroll and its width/height seems wrong, the label is gone, and the emoji picker is completely gone... And whatever I do, I end up with the same result. Through lldb, I have dived into the touchbar: the CharacterPicker popover has the correct PopoverButtonItem and its associated popoverTouchBar only contains one element that has the NSTouchBarItemIdentifierCharacterPicker identifier.

Seen from here, there are only two possibilities:

  1. I am missing a parameter, an attribute, a whatever somewhere. That's not surprising given how superficial (to remain polite) the documentation is about this. The paragraph quoted above is the ONLY thing you can find about the CharacterPicker...
  2. there is a bug somewhere in Apple's code and Apple's own code works around it but it's totally impossible for me to find out what's going on here...

If you work at Apple or are a Touchbar expert and think you can help, please leave a comment here. This is true blocker to me and all the various approaches I tried to create the touchbar (manually created, dynamic, creating items, using only identifiers) lead to exactly the same horked result above. Thanks!

Addendum: OS X 10.12.4, Xcode 8.3 (8E162).