我正在尝试使用以下代码将Today扩展连接到我的应用程序:
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)
}
然而,正确激活该方法会打开我的应用程序,但无需调用即可以标准方式启动它:
-(BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url
可能是什么问题?我当然将我的窗口小部件注册在info.plist文件中,否则该应用程序可能甚至没有打开。
最终确实调用了委托方法。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句