【发布时间】:2014-11-20 16:58:13
【问题描述】:
我试图让我的应用程序能够捕获启动它的 url,并解析传递的值。
这是在 ObjC 中的实现方式
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
[event paramDescriptorForKeyword:keyDirectObject] ;
NSString *urlStr = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
// Now you can parse the URL and perform whatever action is needed
NSLog(@"URL: %@", urlStr);
}
到目前为止我所拥有的是..
func handleGetURLEvent(event: NSAppleEventDescriptor?, replyEvent: NSAppleEventDescriptor?) {
}
【问题讨论】:
标签: objective-c cocoa url swift uri