Resolved OS X today widget launch containing app

Discussion in 'Mac Programming' started by abcdefg12345, Feb 5, 2016.

  1. abcdefg12345 macrumors regular

    abcdefg12345

    Joined:
    Jul 10, 2013
    #1
    hi, i'm trying to launch an app through its today widget with no success

    Code:
    - (IBAction)LaunchContainingApp:(id)sender {
        NSURL *customURL = [NSURL URLWithString:@"appname://"];
        [self.extensionContext openURL:customURL completionHandler:nil];
    }

    Screen Shot 2016-02-06 at 3.27.15 AM.png

    what am i doing wrong i click the button and nothing happens
     
  2. abcdefg12345 thread starter macrumors regular

    abcdefg12345

    Joined:
    Jul 10, 2013
    #2
    got it working
    Code:
    - (IBAction)LaunchContainingApp:(id)sender {
        NSURL *customURL = [NSURL URLWithString:@"appname://launch"];
        if (![[NSWorkspace sharedWorkspace] openURL: customURL]) {
            [[self extensionContext] openURL:customURL completionHandler:^(BOOL success) {
            }];
        }
    }
     

Share This Page