#import "AppDelegate.h"
@interface AppDelegate ()
@property (weak) IBOutlet NSWindow *jj;
@end
@implementation AppDelegate
@synthesize jj;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
[NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskSwipe | NSEventMaskBeginGesture | NSEventMaskGesture | NSEventMaskEndGesture handler:^(NSEvent *event) {
NSLog(@"local");
return event;
}];
[NSEvent addGlobalMonitorForEventsMatchingMask:NSEventMaskSwipe | NSEventMaskBeginGesture | NSEventMaskGesture | NSEventMaskEndGesture handler:^(NSEvent *event) {
NSLog(@"global");
}];
NSDistributedNotificationCenter* center;
center = [NSDistributedNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(a) name:@"com.apple.screenIsLocked" object:nil];
NSWindow* a = [[NSApplication sharedApplication] windows].firstObject;
[a makeKeyAndOrderFront:nil];
[a setLevel:kCGMaximumWindowLevel];
}
- (void)a {
NSLog(@"sibar");
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
[NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskSwipe | NSEventMaskBeginGesture | NSEventMaskGesture | NSEventMaskEndGesture handler:^(NSEvent *event) {
NSLog(@"local");
return event;
}];
}
- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}
@end
I want to get touch event when on lock screen
I want to develop custom lock screen
So I try to show screen over lock screen and get event
show screen is slove by [window makeKeyAndOrderFront:nil];
but event is not received
It is because window and app can't get focus
Please help me
// I will upload app on App Store, so I need non-sandbox-violance solution