Closed pedrovieira closed 9 years ago
Apparently the issue had to do with the defaults key string which had a "." on it, like: "Shortcut Open Last.fm". Removing the dot from the string made it work without any problems. Although I managed to fix my error, this should be fixable because the 1.x version of MASShortcut didn't have this kind of issue.
I think I have fixed the issue. Can you please test with the latest version?
Hm, not really, the current test case is passing because it’s broken. Let me take another look.
The problem is that dots in user defaults keys are apparently not 100 % supported by Cocoa.
I have written a test project that binds a user defaults key to a text field. With a plain user defaults key such as foo
everything works as expected – the defaults value is propagated to the text field, both initially and when I change the defaults using [[NSUserDefaults standardUserDefaults] setObject:… forKey:…]
.
Now, when I change the key name to contain a dot (foo.bar
), the value is propagated to the text field initially, when the app starts, but subsequent changes to user defaults are not reflected in the text field (though they are written to disk). This is true both for bindings created in the Interface Builder and bindings created in code using bind:toObject:withKeyPath:options:
.
In other words, I think you should change your defaults key names to something identifier-like (openLastFm
). I have no idea how this could be fixed in MASShortcut – sorry.
I've recently switched from MASShortcut 1.0 to 2.0 and now I've been experiencing this bug:
Here's the code I'm currently using (which worked before I updated from
MASShortcut registerGlobalShortcutWithUserDefaultsKey:handler:
toMASShortcutBinder bindShortcutWithDefaultsKey: toAction:
):When debugging, my program completely crashes at this point giving the following error message on the console:
Any ideas on what's making this crash? It's so weird because I am listening to more shortcuts the same way as above, with other shortcut constant identifiers, and it's passing my debugging without a problem. Only this one is making my app crash.