iosobjective-cios8ios-app-extensioncustom-keyboard

Detect if Custom Keyboard has been installed


I've read through the documentation and can't seem to find any method of how can I detect if a custom keyboard has been installed in settings>general>keyboards?

Does anyone know of any?


Solution

  • This is possible with NSUserDefaults. Just retrieve the standardUserDefaults object which contains an array of all the keyboards the user has installed for key "AppleKeyboards". Then check if the array contains the bundle identifier for your keyboard extension.

    NSArray *keyboards = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleKeyboards"];
    NSLog(@"keyboards: %@", keyboards);
    
    // check for your keyboard
    NSUInteger index = [keyboards indexOfObject:@"com.example.productname.keyboard-extension"];
    
    if (index != NSNotFound) {
        NSLog(@"found keyboard");
    }