Search code examples
iosswiftios8-today-widgettoday-extension

self.extensionContext!.openURL open app but calls no method


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.


Solution

  • It did end up calling the delegate method.