3
我注册使用NSAppleEventManager苹果事件处理程序:回复的苹果事件在可可
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:)
forEventClass:kInternetEventClass andEventID:kAEGetURL];
我的处理方法,当然,对事件进行接收和回复事件:
- (void) handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
//Open this URL; reply if we can't
}
因此,如果我需要回复一个错误,表明我以某种方式打开此URL失败,那么我应该如何使用replyEvent
来做到这一点?
但如何发送此回复? – jimwan 2017-02-21 05:45:48
@ jimwan:可可自动发回。它向你提供了一个物件供你填写细节。 (实际上,Cocoa只是作为一个介于两者之间的底层Apple底层事件API为Cocoa提供了回复事件对象并自动发回。) – 2017-02-21 23:06:08