Get List of Installed International Keyboards

The NSUserDefaults object is typically used to save/restore your application related preferences, configuration data, etc – see Write and Read User Preferences for more information. In addition to application specifics, there is a system wide default list that is available to all applications, accessible using the class method standardUserDefaults in the NSUserDefaults object.

To get a list of the system wide settings:

NSDictionary* defaults = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
NSLog(@"Defaults: %@", defaults);


A partial list of the output on my device follows:

Defaults: {
    AppleICUForce24HourTime = 0;
    AppleITunesStoreItemKinds =     (
        wemix,
        podcast,
        ...
    );
    AppleKeyboards =     (
        "en_US@hw=US;sw=QWERTY",
        "zh_Hant-HWR@sw=HWR",
        "emoji@sw=Emoji"
    );
    AppleKeyboardsExpanded = 1;
    AppleLanguages =     (
        en,
        "zh-Hant",
        fr,
        de,
  ...
}

As you can tell, the defaults returned above are contained within a dictionary object. The list of keyboards in the dictionary is stored as an NSArray object. To retrieve the array, simply request the object for the key “AppleKeyboards

NSArray *array = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleKeyboards"];
NSLog(@"Keyboards: %@", array);

The output of all the installed international keyboards looks as follows:

Keyboards: (
    "en_US@hw=US;sw=QWERTY",
    "zh_Hant-HWR@sw=HWR",
    "emoji@sw=Emoji"
)
  1. I have some apps that are multi-lingual. I wonder if it’s possible to switch language keyboards on the fly. For example, an english-russian flip card app that has an english keyboard on one side, and a russian on the other. I do this now, by having setting the international keyboard option for both languages, but the user has to select manually…

    Thanks for the helpful posts…

Comments are closed.