Thanks to Guy's comment, there is a better way to do this. I updated my own code to use the following:
NSArray *keyboards = [UITextInputMode activeInputModes]; for (UITextInputMode *mode in keyboards) { NSString *name = mode.primaryLanguage; if ([name hasPrefix:@"zh-Han"]) {
Swift: ( Note : Crash in iOS 9.x due to poor declaration for UITextInputMode activeInputModes . See this answer for a workaround.)
let keyboards = UITextInputMode.activeInputModes() for var mode in keyboards { var primary = mode.primaryLanguage if let lang = primary { if lang.hasPrefix("zh") {
Old approach:
I donβt know if this is allowed or not in the App Store application, but you can do:
NSArray *keyboards = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleKeyboards"]; for (NSString *keyboard in keyboards) { if ([keyboard hasPrefix:@"zh_Han"]) {
It is possible that if the user has only the default keyboard for his locale, there will be no entry for the AppleKeyboards key. In this case, you can check the user locale. If the locale is for China, then you can assume that they have a Chinese keyboard.
source share