Today App Extension Widget Tap To Open Containing App

前端 未结 5 1164
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-02 15:36

I\'ve implemented a Today widget for my application +Quotes which displays the day\'s quote within the notification center with the help of these Apple Docs. What I\'d like

5条回答
  •  醉话见心
    2020-12-02 16:07

    The answer by @sunseeker is the good one but it is "hidden" in the comments. And as the accepted answer says that this isn't possible, it may mislead visitors.

    this code works:

    - (IBAction)launchHostingApp:(id)sender
    {
      NSURL *pjURL = [NSURL URLWithString:@"hostingapp://home"];
      [self.extensionContext openURL:pjURL completionHandler:nil];
    }
    

    I'm using Xcode 6.0 (6A215l) with Yosemite Beta 1.

    And like Apple says in Handling Commons Scenarios :

    An extension doesn’t directly tell its containing app to open; instead, it uses the openURL:completionHandler: method of NSExtensionContext to tell the system to open its containing app. When an extension uses this method to open a URL, the system validates the request before fulfilling it.

提交回复
热议问题