0

我正在尝试让 3d touch 快速操作起作用,我在下面有这段代码。

我确实得到一个打印件说它被按下但它没有进入我想要的视图控制器。

func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {

            if shortcutItem.type == "LiveFeed" {
                print("Tony: We got to live view")

                guard let navVC = window?.rootViewController as? UINavigationController else { return }
                let storyBoard: UIStoryboard = UIStoryboard(name: "LiveFeed", bundle: nil)
                if #available(iOS 11.0, *) {
                    let composeViewController = storyBoard.instantiateViewController(withIdentifier: "LiveFeedMain") as! LiveFeedMain

                    navVC.pushViewController(composeViewController, animated: false)
                } else {
                    // Fallback on earlier versions
                }

            }
        }

我在 appDelegate 中有这个

4

0 回答 0