我有以下问题。当我在手机上运行我的应用程序时,3d 触摸图标并选择快速操作,它会启动应用程序并显示正确的视图控制器,但是当我将应用程序置于后台并尝试调用快速操作时,它只会打开我拥有的应用程序留下它。所以为了让它工作,我每次都必须杀死我的应用程序。这是我的代码:
func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: (Bool) -> Void) {
if shortcutItem.type == "com.traning.Search" {
let sb = UIStoryboard(name: "Main", bundle: nil)
let searchVC = sb.instantiateViewControllerWithIdentifier("searchVC") as! UINavigationController
let root = UIApplication.sharedApplication().keyWindow?.rootViewController
root?.presentViewController(searchVC, animated: false, completion: { () -> Void in
completionHandler(true)
})
}
}
提前致谢。