• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
kTISPropertyUnicodeKeyLayoutData Returns NULL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kTISPropertyUnicodeKeyLayoutData Returns NULL


  • Subject: kTISPropertyUnicodeKeyLayoutData Returns NULL
  • From: Joe Turner <email@hidden>
  • Date: Tue, 25 Aug 2009 13:42:12 -0500

Hey,

So, to translate from a string to a keycode, I've been using the UCKeyboardLayout. But, on some keyboard layouts (only Japanese so far), I get a NULL pointer for the layout, and then the app crashes.

Here's the code:
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
CFDataRef uchr = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData);
keyboardLayout = (const UCKeyboardLayout*)CFDataGetBytePtr(uchr);


The third line is where it will crash, I assume because I am passing NULL into the CFDataGetBytePtr().

In reading the documentation, it seems that the value of property "kTISPropertyUnicodeKeyLayoutData" only returns NULL if there is no layout data, or if the data is KCHR. So, do these users somehow have KCHR keyboard layouts? If so, it seems apple has depricated any methods that could be used to get the data and then keycodes from a KCHR resource. So, is there any way around this?

Cheers,

Joe
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: NSTreeController setSelectionIndexPath depends on sort order
  • Next by Date: Synchronizing NSWindow updates with threads
  • Previous by thread: NSTreeController setSelectionIndexPath depends on sort order
  • Next by thread: Synchronizing NSWindow updates with threads
  • Index(es):
    • Date
    • Thread