I think I might be missing something about how starting a workout is supposed to work with SiriKit. My initial thought was that I would be able to tell Siri "Start a running workout in MYAPP" which would cause MYAPP to launch (either in the background or foreground) and a NSUserActiviry object would be passed to the application:continueUserActivity:restorationHandler method. There I could start my workout as if the user had pressed a start workout button in my app.
To try to do this, I created a Siri intent handler that implements the INStartWorkoutIntentHandling protocol. I updated my .plist file to include the start workout type and I requested permisson to Siri using INPreferences.requestSiriAuthorization. Everything here works great - I can get Siri to resolve my workout request and I get to the handle:startWorkout:completion with everything I need to start the workout the way I want.
Here is where my trouble lies. I have not been able to get Siri to launch my main app and hand over the NSUserActivity object I create. The extension is a separate process, so there is no memory sharing between the two, and there doesn't seem to be any way to talk between the two processes. It looks like from all of the documentation, WWDC sessions, and examples that you are supposed to handle your workout from your intent extension code - not your main app code! You could in theory do this by moving all of your workout code into a framework (most of mine already is) but it doesn't seem like this is the right place to be handling this kind of data. I would expect the live span of an intent extension to be short lived, which many workouts are not (marathon runners may be going for several hours).
One thought I had with this was perhapts the workout is supposed to be passed along to an Apple Watch, since it has HKWorkoutSession support. There is a nifty new method in iOS 10 that lets you launch a workout on your watch from your iOS device (HKHealthStore. startWatchAppWithWorkoutConfiguration). However, calling this method on the intent extension returns a healthkit error stating you can't launch a workout on the Apple Watch when the main app is in the background. I'm kind of at a loss as to how this is supposed to work. When you use Siri to start a workout, is Siri supposed to become the only UI for your workout? This type of interaction makes sense for things like payment processing, but I'm not sure this makes sense for workout apps...
Any thoughts or suggestions would be appreciated!