Building a multidevice workout app issue

Hi! I've added the code of the multidevice workout app from Apple to my app and I found some issues that I cannot see on the sample app.

In my app, to pause or end the workout from the watch, the iOS companion app has to be opened or at least on background, but never closed.

What I'm doing wrong?

Answered by DTS Engineer in 799947022

Assuming the Apple sample you mentioned is Building a multidevice workout app, it contains a standard iOS app to its companion watchOS app. Other than using HealthKit, the apps don't do anything special.

In the case where your app doesn't behave the same as our sample, an effective way to find the reason is that you figure out how you do differently by comparing the two projects. If the difference isn't obvious, you can try to gradually add your code or apply your configuration to the Apple sample, until the issue reproduces. You can also try the other way around – reducing your project, until the issue disappears.

If you still need help after finding what you do differently, feel free follow up here and I would take a closer look.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Assuming the Apple sample you mentioned is Building a multidevice workout app, it contains a standard iOS app to its companion watchOS app. Other than using HealthKit, the apps don't do anything special.

In the case where your app doesn't behave the same as our sample, an effective way to find the reason is that you figure out how you do differently by comparing the two projects. If the difference isn't obvious, you can try to gradually add your code or apply your configuration to the Apple sample, until the issue reproduces. You can also try the other way around – reducing your project, until the issue disappears.

If you still need help after finding what you do differently, feel free follow up here and I would take a closer look.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Yes, that is the sample app. I've worked with the GPT to look at the differences, and the only different thing is the workoutType, workout location, statistics... the logger and the workoutManager with its extensions are the same, just UI changes.

If I don't call .retrieveRemoteSession() on the iPhone app before taping pause or end at the watch I'm not able to control the workout session. The iOS app needs to be running. It's weird, because this doesnt happen running my app on the simulator.

Building a multidevice workout app issue
 
 
Q