The DDHotKey example project uses a precompiled header file DDHotKey_Prefix.pch with the contents
#ifdef __OBJC__ #import <Cocoa/Cocoa.h> #endif
so <Cocoa/Cocoa.h> automatically included by all Objective-C sources. This, in turn, includes the foundation structure and AppKit headlines.
New Xcode projects no longer create precompiled header files. If you simply copied the source files from the sample project into a new project, your error will occur.
You can add a precompiled header file to your project, but actually itβs enough to add
#import <AppKit/AppKit.h>
in "DDHotKeyUtilities.m".
source share