NSEvent不起作用

有人可以告诉我以下代码有什么问题。我想模拟一个“a”。
NSEvent* keyEvent = [NSEvent keyEventWithType:NSKeyDown location:NSZeroPoint modifierFlags:NSCommandKeyMask timestamp:0 windowNumber:[windowNumber intValue] context:[NSGraphicsContext currentContext] characters:@"A" charactersIgnoringModifiers:nil isARepeat:NO keyCode:0];
[NSApp postEvent:keyEvent atStart:NO];
    
已邀请:

要回复问题请先登录注册