[英]How to avoid keeping watch app in front when using HKWorkoutSession?
I have developed an iPhone app with watch app for getting live stream of heart rate. 我开发了带有手表应用程序的iPhone应用程序,以获取实时心率流。 As mentioned in many stackoverflow threads iOS get heart rate from Apple Watch in near real time , i have used HKWorkoutSession to get the updated heart rate and sending it to server (Workout session will always be active to get live stream of heart rate) .
如许多stackoverflow线程中所述, iOS近乎实时地从Apple Watch获取心率 ,我使用HKWorkoutSession来获取更新的心率并将其发送到服务器(锻炼会话将始终处于活动状态以获取实时心率流) 。
The issue here is, this application always stays in front of watch app(which is the expected behaviour when we use HKWorkoutSession ). 这里的问题是,此应用程序始终位于监视应用程序的前面(这是我们使用HKWorkoutSession时的预期行为)。 But i don't want this behaviour to happen, since the app only does the job of getting heart rate updates and sending it to server.
但是我不希望这种行为发生,因为该应用程序仅执行获取心率更新并将其发送到服务器的工作。
My app now sends the heart rate correctly to server even when the watch screen is off and when the app is in background since i have used Required background modes (Watch) in info.plist . 我的应用程序现在即使在手表屏幕关闭且应用程序在后台的情况下也可以将心率正确发送到服务器,因为我已经在info.plist中使用了必需的 后台模式(手表) 。
Is there any way that we can avoid this app being in front of watch face every-time the user opens the watch? 有什么方法可以避免每次用户打开手表时此应用都位于表盘前面?
You cannot avoid making you app frontmost while in a workout session on watchOS. 在watchOS上进行锻炼时,您无法避免将您的应用置于最前面。 You should file a bug with Apple to request an API with the behavior you want for your app.
您应该向Apple提交错误,以请求具有您想要的应用行为的API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.