Pause the workout session as soon as you start it.
https://stackoverflow.com/a/64288974/8174191
Post
Replies
Boosts
Views
Activity
Still broken in iOS 14.1.
Actually it looks like it's broken in a different way though. I think it's behaving as expected except opening popovers, sheets, and alerts causes onAppear of the parent view to get called, but only the first time a popover, sheet, or alert is opened. Super weird behavior.
I don't think when it worked vs when it didn't is all that complicated. Here is a rough timeline of watchOS versions and my believed status of websockets (outside of audio sessions) on them:
watchOS 6: I don't believe websockets worked at all. I remember seeing the release notes saying they were supported, but I tried them and they didn't work. I actually thought it was a bug that they didn't work because the release notes clearly state that URLSessionWebSocketTask is supported and lists no caveats.
watchOS 7: I tried websockets again and they worked perfectly. I thought this meant that the bug preventing websockets from working was fixed.
watchOS 8: Some version of watchOS 8 broke the ping function of URLSessionWebSocketTask, but NWConnection websockets still worked fine
watchOS 9: All websockets stopped working completely
I'm not sure what people were doing that made this confusing unless they were testing across watchOS versions. Even Google has the Firebase Realtime Database package for watchOS that uses websockets, so it's not like just small users got confused. Websockets worked perfectly for at least one year, and mostly fine for at least 2. Also many apps for watchOS that use websockets "incorrectly" apparently got approved for the App Store (Spotify possibly being one of them since their app also broke with watchOS 9).
My big question is WHY are websockets not allowed to be used outside of audio sessions? The use-cases for websockets on watchOS aren't going to magically go away if you say they aren't allowed. How is spamming rest calls instead a better solution?
Even at this very moment the page for URLSessionWebSocketTask says it is supported on watchOS 6+, with no mention of it not working outside of audio streaming: https://developer.apple.com/documentation/foundation/urlsessionwebsockettask
This works for me
WindowGroup {
ContentView()
}.windowStyle(.plain)