0

I am trying to wire the Today extensions to my app by using the following piece of code:

override func tableView(tableView: UITableView, accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath) {
    let selection=busCollection[indexPath.row];
    let palina=selection?.palina;
    let urlAsString = "widget://pathto/" + "\(palina)"
    let url = NSURL(string: urlAsString)
    self.extensionContext!.openURL(url!, completionHandler: { (success: Bool) -> Void in
            print("completed")
        }
    )
    tableView.deselectRowAtIndexPath(indexPath, animated: false)
}

Yet activating that method correctly opens my app but launches it in the standard way without calling:

-(BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url

What may be the issue? Of course I registered my widget on the info.plist file, otherwise the app would probably not have been even opened.

Fabrizio Bartolomucci
  • 4,948
  • 8
  • 43
  • 75
  • Did you implement the `application:openURL:sourceApplication:annotation:` method in your AppDelegate? – Bannings Jun 14 '15 at 07:35
  • Sure, even if I use it for receiving requests for directions. The source I read suggested it was: -(BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url to be called by the extension. At any rate, neither of them is called as I put breakpoints in each of them, just in case. – Fabrizio Bartolomucci Jun 15 '15 at 21:21

1 Answers1

0

It did end up calling the delegate method.

Fabrizio Bartolomucci
  • 4,948
  • 8
  • 43
  • 75