cocoabits / MASShortcut

Modern framework for managing global keyboard shortcuts compatible with Mac App Store. More details:
http://blog.shpakovski.com/2012/07/global-keyboard-shortcuts-in-cocoa.html
BSD 2-Clause "Simplified" License
1.52k stars 220 forks source link

NSShiftKeyMask et al. do not appear to be working #68

Closed jhoughjr closed 8 years ago

jhoughjr commented 9 years ago

I am using base SDK 10.10 with a deployment target of 10.9. There were around 9 build errors with 2.1.2 using cocoa pods. The errors were from the NSShiftKeyMask et al. not being defined even though Carbon.h was imported at the top of the file. A search of Carbon.h revealed they were not there. A Google search revealed they are defined in AppKit/NSEvent.h

My fix was to add #import AppKit/NSEvent.h to the file MASKeyCodes.h I'm not sure why this happened as I had been using MASShorcut for a while with no issues. I had modified my copy to customize the font color. This issue appeared after I updated the pods to overwrite my font color change code since it wasn't needed anymore in my application as the design had changed.

zoul commented 9 years ago

Are you sure it’s not just your build environment? The Travis build appears to work just fine.

jhoughjr commented 9 years ago

It used to build fine until i did a pod update. But I don’t know what Travis CIs build environment is compared to a standard Xcode with cocoa pods installation.

On Apr 2, 2015, at 1:37 PM, Tomáš Znamenáček notifications@github.com wrote:

Are you sure it’s not just your build environment? The Travis build appears to work just fine https://travis-ci.org/shpakovski/MASShortcut.

— Reply to this email directly or view it on GitHub https://github.com/shpakovski/MASShortcut/issues/68#issuecomment-89004648.

zoul commented 9 years ago

I’ll take a look at it the next week :+1:

jhoughjr commented 9 years ago

Thanks! The last time i updated via cocoa pods was a month or two ago, and the only things that changed as updating the pod, and I think a couple versions of Cocoapods have been released since then.

But when I searched Cabon.h for NSShiftKeyMask for instance I didn’t find it. Hopefully that info is useful.

On Apr 3, 2015, at 2:33 AM, Tomáš Znamenáček notifications@github.com wrote:

I’ll take a look at it the next week

— Reply to this email directly or view it on GitHub https://github.com/shpakovski/MASShortcut/issues/68#issuecomment-89205725.

jhoughjr commented 9 years ago

I was able to get it to build in debug mode by importing AppKit in MASKeycodes.h

import <Carbon/Carbon.h>

import <AppKit/AppKit.h>

// These glyphs are missed in Carbon.h enum { Without that, NSShiftKeyMask et al aren’t found, and it complains about NSView being a forward declaration, 11 errors in total. That is from a fresh install of the pod after deleting ./Pods the .xcworkspace and the Podfile.lock, and letting cocoa pods regenerate the xcworkspace.

My guess is cocoa pods isn’t linking it with AppKit maybe. Anyway hope that helps.

On Apr 3, 2015, at 2:33 AM, Tomáš Znamenáček notifications@github.com wrote:

I’ll take a look at it the next week

— Reply to this email directly or view it on GitHub https://github.com/shpakovski/MASShortcut/issues/68#issuecomment-89205725.

zoul commented 9 years ago

Just tested with latest Cocoapods (0.36.3) and the sample project built fine. Can you reproduce the problem with a clean project? I created a new Xcode project, ran pod init, added MASShortcut to podfile, ran pod install, opened the workspace in Xcode and built fine.

jhoughjr commented 9 years ago

I can try later today. It originally worked for months. Then I reloaded my machine and reckoned the repo, and updated pods. As my above comment states, those imports fixed it, though I'm not sure what issue in the build environment they would be fixing, only that they fixed the proximal build errors.