Today Extension launches Mobile Safari?

Hi All,


I have a Today Extension / Today Widget bundled in an app that supports Universal Links, and I am seeing some inconsistent behaviour. Consider a Today Extension that has a number of rows in a TableView, and the following code that will launch the containing app based on the selected row:


extension TodayViewController: UITableViewDelegate {
    // MARK: UITableViewDelegate

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let id = myItems[indexPath.row].id
        
        guard let url = URL(string: "/someEndpoint/\(id)", relativeTo: myInstanceURL) else {
            DDLogError("Invalid URL")
            return
        }
        
        // Launch the containing app
        extensionContext?.open(url, completionHandler: { (success) in
            if success {
                DDLogDebug("Launched containing app (url: \(url))")
            } else {
                DDLogError("Could not launch containing app (url: \(url))")
            }
        })
    }
}


I am experiencing two different behaviours for these usecases:


  1. when I press the home button and unlock the phone to end up on the home screen / springboard, then swipe left to go to the Today Extension and select one of the rows in the TableView: The containing App is launched properly.
  2. when I press the home button without unlocking the phone (for example with a non-registered finger), then swipe left to the Today Extension (so don't go to the home screen / springboard), then unlock the phone with TouchID and select one of the rows in the Today Extension's TableView: Mobile Safari is launched to open the URL.


My question hence is, how come in the second usecase the containing app is not being launched? And more importantly, how can I make sure the containing app is always launched and not Mobile Safari (without using custom URL Schemes)?

Bump... anybody? 🙂

Today Extension launches Mobile Safari?
 
 
Q