BLACK FRIDAY SALE: Save big on all my Swift books and bundles! >>

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

1      

Hacking with Swift is sponsored by RevenueCat

SPONSORED In-app subscriptions are a pain to implement, hard to test, and full of edge cases. RevenueCat makes it straightforward and reliable so you can get back to building your app. Oh, and it's free if your app makes less than $10k/mo.

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.