diff options
| author | Tomáš Znamenáček | 2015-03-04 16:07:46 +0100 |
|---|---|---|
| committer | Tomáš Znamenáček | 2015-03-04 16:07:46 +0100 |
| commit | a1eeb57ad6785fb709e84bfbfb2b06cba76c8eb5 (patch) | |
| tree | 7e44c7e6557bd1d712e0ee3d7f824a49092e6a80 | |
| parent | 934abde6161cc2b6cd9c0d02537982544c199e65 (diff) | |
| download | MASShortcut-a1eeb57ad6785fb709e84bfbfb2b06cba76c8eb5.tar.bz2 | |
Fix accessibility-related crashes on older OS X releases (#47).
The NSAccessibilityPriorityKey symbol was only introduced in 10.9,
so that we have to check for its availability before using it, otherwise
we get a SIGSEGV.
| -rw-r--r-- | Framework/MASShortcutView.m | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Framework/MASShortcutView.m b/Framework/MASShortcutView.m index d96989c..1e1a0d8 100644 --- a/Framework/MASShortcutView.m +++ b/Framework/MASShortcutView.m @@ -137,12 +137,15 @@ NSString *const MASShortcutBinding = @"shortcutValue"; [self activateResignObserver:_recording]; [self setNeedsDisplay:YES]; - // Give VO users feedback on the result - if (_recording == NO) { - NSString* msg = (_shortcutValue.description) ? - NSLocalizedString(@"Shortcut set", @"VoiceOver shortcut recording feedback") : - NSLocalizedString(@"Shortcut cleared", @"VoiceOver shortcut recording feedback"); - NSDictionary *announcementInfo = [[NSDictionary alloc] initWithObjectsAndKeys:msg, NSAccessibilityAnnouncementKey, @"High", NSAccessibilityPriorityKey, nil]; + // Give VoiceOver users feedback on the result. Requires at least 10.9 to run. + if (_recording == NO && (&NSAccessibilityPriorityKey != NULL)) { + NSString* msg = _shortcutValue ? + NSLocalizedString(@"Shortcut set", @"VoiceOver: Shortcut set") : + NSLocalizedString(@"Shortcut cleared", @"VoiceOver: Shortcut cleared"); + NSDictionary *announcementInfo = @{ + NSAccessibilityAnnouncementKey : msg, + NSAccessibilityPriorityKey : @(NSAccessibilityPriorityHigh), + }; NSAccessibilityPostNotificationWithUserInfo(self, NSAccessibilityAnnouncementRequestedNotification, announcementInfo); } } |
