TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

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

 session.invalidate()

 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...

5      

Hacking with Swift is sponsored by Superwall.

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn More

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.