I am trying to use NSEvent, however if I try to access the class I get an error. I at first thought that it was because I was trying to use it from the main method, but even when I tried to use it in a class it still won't build.
Here is my code:
#import <Foundation/Foundation.h>
#import <appkit/NSEvent.h>
@interface Test : NSObject
@end
@implementation Test
-(id) init {
self = [super init];
if (self) {
NSLog(@"New Test Class");
NSLog(@"%@", [NSEvent class]);
}
return self;
}
@end
int main (int argc, const char * argv[])
{
@autoreleasepool {
NSUInteger eventMask = NSKeyDownMask;
Test *t = [[Test alloc] init];
/*id eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:eventMask handler:^(NSEvent *incomingEvent)
{
NSEvent *result = incomingEvent;
NSLog(@"%i", (int)[result keyCode]);
return result;
}];*/
}
return 0;
}
This is the error that I am getting: