NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

Extended WK Session Help...

Forums > watchOS

I'm a newbie to iOS and watchOS dev, but I have built an app in SwiftUI that is running on both platforms and I am trying to get WKExtendedRuntimeSession behaving as expected. I have added the Extended Mode for the WK extension and have selected Mindfullness which I understood would allow the app to stay active until dismissed or timed out (1hr).

In the view that I want to keep running I initailized a session

var session = WKExtendedRuntimeSession()

and start it when the view appears

.onAppear() { // Start the session object. self.session.start() ... }

and of course invalidate whenever the user quits


 but the behavior seems to be the same with the app going into a background mode after about 10 secs and then if I raise my wrist the animation and sounds are still playing along with the countadown timer but I was expecting it to stay alive until either the user qiut or the timer ran out.  

 Am I missing something here?  Is there a way to debug this since I don't really know if the session is actually working or if I am misunderstanding how this is supposed to work.  Any help will be greatly appreciated...


Hacking with Swift is sponsored by Judo

SPONSORED Let’s face it, SwiftUI previews are limited, slow, and painful. Judo takes a different approach to building visually—think Interface Builder for SwiftUI. Build your interface in a completely visual canvas, then drag and drop into your Xcode project and wire up button clicks to custom code. Download the Mac App and start your free trial today!

Try now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.