0

I am trying to get the 3d touch quick action to work, I have this code below.

I do get a print saying it was pressed but it doesn't go to the view controller I want.

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
                }

            }
        }

I have this in the appDelegate

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Tony Merritt
  • 1,177
  • 11
  • 35
  • Have you set a breakpoint and stepped through? What if `window?.rootViewController` returns `nil`? – Paulw11 Nov 22 '17 at 00:48
  • I have stepped through, what seems to be happening is it is calling to go to the viewcontroller but i have it set so it checks that the user is logged in first. I need it to wait until it has passed through the log in screen first – Tony Merritt Nov 27 '17 at 14:43

0 Answers0