Previous to iOS 9, the most reliable method of determining whether an external keyboard is connected was to listen for UIKeyboardWillShowNotification and make a
Private API solution: (have to grab the private header file - use RuntimeViewer).
Works nicely for enterprise apps, where you don't have AppStore restrictions.
#import "UIKit/UIKeyboardImpl.h"
+ (BOOL)isHardwareKeyboardMode
{
UIKeyboardImpl *kbi = [UIKeyboardImpl sharedInstance];
BOOL externalKeyboard = kbi.inHardwareKeyboardMode;
NSLog(@"Using external keyboard? %@", externalKeyboard?@"YES":@"NO");
return externalKeyboard;
}