1 Reply
      Latest reply on Sep 13, 2019 11:05 AM by edford
      Dave19 Level 1 Level 1 (0 points)

        I'm trying to add a Siri Shortcut to my app which would essentially update the UI in a view controller , but I've got two problems : 1. My app has a tab bar view controller and the activityVC is the third one in the tab bar, but when I run the Siri Shortcut , I get sent to the activityVC ,but without a tab bar 2. When I run the shortcut ,I get transitioned to the activityVC, but updateUI() doesn't run

        Here's what I wrote in my app delegate :

        func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { switch userActivity.activityType { case "start": let sb = UIStoryboard(name: "Main", bundle: nil) let activityVC = sb.instantiateViewController(withIdentifier: Constants.Storyboard.activityVC) as! ActivityViewController let root = UIApplication.shared.keyWindow?.rootViewController root?.present(activityVC, animated: true, completion: nil)  activityVC.updateUI() default: print("no shortcut") } return false }

         

        • Re: Why isn’t this working with Siri Shortcuts ?
          edford Apple Staff Apple Staff (725 points)

          We have a sample code project that sounds very close to what you want. For that sample, visit the detail page for a few of the pizzerias it finds, and then use the iOS search feature from the home screen to search for pizza to see the shortcuts donated by the app. When you pick one of those search results, the shortcut opens the app and navigates to the appropriate view controller.