0

how can I make it so that if the URL is myapp://foo that it will preform an action and if it is myapp://bar it will preform a different action. I've gotten this far with my other question here Help is very much appreciated.

Community
  • 1
  • 1
atomikpanda
  • 1,845
  • 5
  • 33
  • 47

1 Answers1

0

Once you have your URL scheme registered inside your application, you should be able to capture the URL used to open your application with something like this

- (void)handleURLEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent {
    NSString *calledURL = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
    NSLog(@"%@", calledURL);
    // Split and do something with calledURL
}

Once you have that URL you should easily be able to split it and determine what you want to do.

There is another question on exactly this as well.

Community
  • 1
  • 1
Keith Smiley
  • 61,481
  • 12
  • 97
  • 110