iOS 10: Handling Interactions with SiriKit | Ray Wenderlich

Explore the structured data model that Siri uses to parse natural language, and how you can interact with it to provide services.

This is a companion discussion topic for the original entry at

I have a workout app that allows users to track their runs etc. and I’d like to have Siri launch a “New Run” in it. I added the extension, modified the INExtension class to point to my custom class that implements INStartWorkoutIntentHandling. I also added the code for resolving the workout name (although it’s not really necessary for my app) and I gave a standard confirm with .ready. The part I’m missing is, from the “handle” method, how do I launch the app with the “New Run” screen? I understand extensions are separate from their container app and that is the case for SiriKit extensions, but not having done this integration before, I was wondering if there’s any best practice for doing that.

Hi @marstech,

It’s been a while since I played around with SiriKit extensions, so I can’t remember precisely what to do. However, I’ll tell you what I think I remember and hopefully it’ll be of some use to you.

  1. You have to create an INStartWorkoutIntent as part of the SiriKit extension.
  2. Create this with the INStartWorkoutIntentResponseCode with value continueInApp. This will get Siri to open your app.
  3. At the same time, create an NSUserActivity that provides the info that your app needs to start the workout.
  4. In your app delegate, implement the application(_:continue:restorationHandler) method to get your app into the appropriate state given the NSUserActivity, i.e. to start the workout.

Hope that’s helpful


Thanks @samdavies! I did in fact implement what you described above (after living on StackOverflow for a few hours :]).
In _:continue:restorationHandler, I’m using the following condition to detect the type of activity it has received (I’m only interested in Start and End workout) and I’m successfully going in there. However, for some reason, it’s not invoking the actual workout, but that’s likely a problem in my app logic itself, so I’ll work on that.
I appreciate your response! :+1:

if ([ @"INStartWorkoutIntent" isEqualToString:userActivity.activityType])

1 Like