How do Live Activities (ActivityKit) and WeatherKit work, and what are their limits?
Predict first
A Live Activity must show a delivery’s progress while the app is closed. How does the new state reach the Lock Screen?
// A: the widget extension downloads the status itself
// B: your server sends an ActivityKit push through APNs that carries the new content state
// C: the app must stay running in the background
- A
- B
- C
Mental model. A Live Activity is a sports scoreboard that the arena (your server) updates by remote control. It has a fixed-size display (4 KB), a maximum running time, and the building’s staff (the system) can switch it off.
Live Activities show real-time, glanceable information (a delivery, a sports score, a ride) on the Lock Screen, in the Dynamic Island and in StandBy. You define an ActivityAttributes type (fixed data, such as the order id) with a nested ContentState (the data that changes), request an activity with Activity.request(attributes:content:pushType:) from the foreground app, and render it in a widget extension with SwiftUI (ActivityConfiguration, with compact, expanded and minimal Dynamic Island layouts). The ContentState is encoded as JSON and must stay small (the combined static attributes and state are limited to 4 KB). Update from the app with activity.update(_:), or, since the app is usually not running, via ActivityKit push notifications: ask for a pushType: .token, send the activity’s push token to your server, and send APNs pushes with apns-push-type: liveactivity and the apns-topic ending in .push-type.liveactivity, carrying a new content-state (with an event of update or end, and optional stale-date). Limits: an activity runs for at most 8 hours of active life (then the system ends it, and it may remain on the Lock Screen up to 4 more hours), there is a cap on concurrent activities per app, updates are budgeted (frequent updates need the NSSupportsLiveActivitiesFrequentUpdates key and may still be throttled), no network from the widget extension (all data comes through the state), and the user can disable them per app. Design for a clear lifecycle: start on an explicit user action or event, update only when something meaningful changes, end promptly with a final state, and handle the user dismissing it. Alerts (AlertConfiguration) can wake the screen for urgent changes.
WeatherKit gives current conditions, hourly and daily forecasts, minute-by-minute precipitation, severe-weather alerts and historical data for a location, through WeatherService.shared.weather(for: location) (or the REST API for non-Apple clients). It needs the WeatherKit capability (an entitlement and an App ID with the service enabled), is metered (a monthly free allowance with Apple Developer Program membership, then paid tiers), returns data as Swift types (Weather, CurrentWeather, HourWeather, DayWeather) with Measurement values that you format for the user’s locale, and requires attribution: show the Apple Weather trademark and a link to the legal source page (WeatherService.shared.attribution) near the data. Cache the results (forecasts change slowly, and caching saves quota and battery), handle the network and entitlement errors, and combine with Core Location for the user’s place (when the user shares it). For both frameworks, check the current limits in the documentation, since quotas and policies evolve.
The widget cannot use the network, and the app is usually suspended, so updates arrive as push notifications of the live-activity type.
Common traps
- Trying to fetch data from the Live Activity widget code. It cannot use the network; push or update the content state instead.
- Omitting the WeatherKit attribution. It is a requirement; show the mark and the legal link.
They might follow up with
- How are Live Activities updated when the app is not running? ActivityKit pushes sent through APNs with the live-activity push type.
- What are the Live Activity size and time limits? About 4 KB of data and up to 8 hours of active life.
Related questions
- 17.1.2 How does the Apple Push Notification service deliver a push: tokens, priority, collapse, expiry, and what can…
- 17.6.2 What are App Clips and CarPlay, what constraints do they impose, and when would you build them?
- 17.7.1 How do you approach an unfamiliar Apple framework: what do you check before you write code, and how do you…
What are App Clips and CarPlay, what constraints do they impose, and… →