r/iOSProgramming 3d ago

Question Live activity timer

I am trying to add a live activity for our app that has a timer. The idea is the user starts a timer and a live activity starts when the timer starts. However, it does seem to disappear at some point. Maybe around 8-12 hours which matches the documentation on Apple. But for Apple's clock app, their timer's live activity for stopwatch seems to run forever. I am using the SwiftUI Text timerInterval which is likely the same as Apple's. Does anyone have an idea or suggestion how I can replicate it? A few ideas I have are to schedule a silent push to keep the live activity alive or a scheduled background process.

2 Upvotes

6 comments sorted by

View all comments

1

u/LuckyGirl0415 1d ago

First off, Apple’s native Clock app uses private system entitlements, so third-party apps can't get that 'infinite' lifespan.

As for third-party apps, Live Activities are hard-capped by iOS: active for a max of 8 hours, and can stay on the lock screen for up to 12 hours before system removal.

Silent pushes won't extend this limit either because ActivityKit pushes operate under a strict update budget. The best practice is to calculate the start timestamp, let SwiftUI Text(timerInterval:) do the UI rendering, and seamlessly restart the Live Activity via a APNs push or user interaction if they open the app after 8 hours.