matm matm - 10 months ago 91
iOS Question

Can I disable custom keyboards (iOS8) for my app?

EDIT: tl;dr - it is possible, see accepted answer below.

Is there any (not only programatic) way of preventing custom keyboards (iOS8) from being used for my application? I am mainly interested in "per-app" setting, so just my app is not allowed to use custom keyboards, but disabling custom keyboards system-wide is last resort.

So far I know that custom keyboards are system-wide and can be used by any application. The OS will fallback to stock keyboard only for secure text entry (text fields with

set to
). Not much hope here.

I got an impression from
App Extension Programming Guide
that MDM (Mobile Device Management) can restrict device from using custom keyboards at all, but I didn't find that option in the new beta version of
for OS X Yosemite. Is 'Configurator' just missing that option?

Any ideas here? Should I file a radar to suggest that Apple should introduce such functionality?

Answer Source

Looks like you got what you wanted in beta seed 3. Line 440 of UIApplication.h:

// Applications may reject specific types of extensions based on the extension point identifier.
// Constants representing common extension point identifiers are provided further down.
// If unimplemented, the default behavior is to allow the extension point identifier.
- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString *)extensionPointIdentifier NS_AVAILABLE_IOS(8_0);

It's not currently included in the docs, but sound like it will do exactly what you asked here.

I'm guessing these "extension point identifiers" are not unique identifiers of extensions, but of their types, as there is also this on line 545:

// Extension point identifier constants
UIKIT_EXTERN NSString *const UIApplicationKeyboardExtensionPointIdentifier NS_AVAILABLE_IOS(8_0);

TLDR: to disable custom keyboards you would include something like this in your app delegate:

- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString *)extensionPointIdentifier {
    if ([extensionPointIdentifier isEqualToString: UIApplicationKeyboardExtensionPointIdentifier]) {
        return NO;
    return YES;