I have a protocol handler associated with my Cocoa application.
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler:self
andSelector:@selector(getUrl:withReplyEvent:)
forEventClass:kInternetEventClass andEventID:kAEGetURL];
…
- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
#ifdef DEBUG
NSLog(@"%s: %@",__PRETTY_FUNCTION__,event);
#endif
NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]];
...
}
Who is referrer? (if it called from local machine I think it can be undefined, but if I call
this protocol from a Web site… I would like to know domain from which the request is received.
Is it possible at all?
Is there solution to solve this task by another way?
From:
http://www.cocoabuilder.com/archive/cocoa/125741-finding-the-sender-of-an-appleevent-in-cocoa-app-on-10-2-8-or-greater.html