don't try to handle physical keyboard events on iOS <9

This commit is contained in:
Jesús A. Álvarez 2016-06-06 20:13:02 +02:00
parent cc3b3bc59a
commit 76b82d92fc
1 changed files with 10 additions and 1 deletions

View File

@ -101,7 +101,16 @@ static int8_t usb_to_adb_scancode[] = {
- (void)handleKeyUIEvent:(UIEvent *)event {
[super handleKeyUIEvent:event];
if ([event isKindOfClass:keyboardEventClass]) {
static dispatch_once_t onceToken;
static BOOL handleKeyboardEvents = YES;
dispatch_once(&onceToken, ^{
if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) {
handleKeyboardEvents = [NSProcessInfo processInfo].operatingSystemVersion.majorVersion >= 9;
} else {
handleKeyboardEvents = NO;
}
});
if ([event isKindOfClass:keyboardEventClass] && handleKeyboardEvents) {
[self handleKeyboardEvent:(UIPhysicalKeyboardEvent*)event];
}
}