Widgets & Live Activities

RSS for tag

Discuss how to manage and implement Widgets & Live Activities.

WidgetKit Documentation

Posts under Widgets & Live Activities subtopic

Post

Replies

Boosts

Views

Activity

How to determine the cause of errors in LiveActivity and DynamicIsland
I have developed a LiveActivity on my product that supports DynamicIsland. Recently, two users encountered this situation while updating the app: LiveActivity was created with a status of. active, but after 100ms, it immediately started displaying as. dimiss. This process was repeated many times until the user restarted their iPhone and the display became normal A user's LiveActivity was successfully created with a status of. active, and the data was updated using the. update method normally; But this user's interface keeps showing a gray component empty state I am unable to obtain useful information regarding the bug encountered in processing. I would like to know how to obtain the reason why the user's LiveActivity has been modified to. dimiss by the iOS system in the face of these situations; How can I obtain useful information to determine the cause of the error when the user interface cannot display data without debugging. Thank you~
0
0
23
4w
Should `input-push-token` be added to all live-activity based payloads?
I'm struggling to understand what the impact of this flag is. Docs only say: For devices running iOS 18 and iPadOS 18 or later, you can add input-push-token: 1 to your payload to start a Live Activity and receive a new push token. After you receive a new push token, you can use it to send updates to a Live Activity. But things were working fine for iOS 17. Right? Does it somehow make the OS emit update tokens faster/more successfully? Should I include in all start, update, end events?
2
0
167
4w
Inquiry regarding a change in AlarmKit Live Activity presentation behavior (iOS 26.0 vs. 26.1)
Hello, We have observed a change in the presentation behavior of the AlarmKit Live Activity banner when our application is in the foreground, following the update from iOS 26.0 to iOS 26.1. We would like to clarify which behavior is intended. In iOS 26.0: When our application was in the foreground, the AlarmKit Live Activity banner did not present. In iOS 26.1: The AlarmKit Live Activity banner now presents even when our application is in the foreground. Could you please advise on what the correct or desired behavior is for this scenario? Thank you for your clarification.
0
0
64
4w
Dose AlarmKit Live Activity not trigger .widgetURL?
Hello, I would like to inquire about a specific behavior I've observed with Live Activities to determine if it is a bug. When our application is closed but the device is in use, an alarm triggers a Live Activity to appear at the top of the screen. However, it seems that tapping the background area of this Live Activity does not trigger the .widgetURL and .onOpenURL Could you please confirm if this is the intended behavior? or should I config another setting for desired action like trigger .onOpenURL? Thank you for your time and assistance. Best regards,
0
0
28
Nov ’25
Cannot get app into Control Center on physical device.
I want to add my app to Controls, just a button to open the app. The end goal is to put it on a lock screen. However, I can get it to work on the iPhone simulator, but I am unable to get it on my actual device. No warnings or failed build or signing issues. I feel like I have changed and tinkered everything. I feel like my code is correct, so maybe it's an issue of the signing? I am lost. Running the control center stuff through Widgetkit.
0
0
94
Oct ’25
Push tokens from push-to-start Live Activities require user permissions?
Just wanted to clarify some expected behaviors here. It seems that there are two distinct behaviors for Live Activity flows for freshly installed apps. When you start a Live Activity for the first time and the user hasn't yet clicked on Allow/Don't Allow in the activity interface, there are two different sequences: Starting a Live Activity locally Request a Live Activity locally via Swift Live Activity starts .pushTokenUpdates is immediately triggered, even if the Allow/Don't Allow buttons appear under the Activity UI Starting a Live Activity via push-to-start Send a push-to-start notification to launch a Live Activity Live Activity starts .pushTokenUpdates is not triggered, and .pushToken returns nil. If a user clicks on Allow in the Activity UI, only then is .pushTokenUpdates triggered.
2
4
156
Oct ’25
Can you include an `alert` with a sound within the `end` event?
Q1. Can you place a sound on an end event? That doesn't seem to work for us Additionally: Q2. Is there any way that after you send the end event, still have the Live Activity remain on the Dynamic Island until the dismissal-date? Currently when an end event is sent, it's abruptly ended from the Dynamic Island without any sound. Users are confused until minutes/hours later they see their Lock Screen.
0
0
101
Oct ’25
Optional Parameter using WidgetConfigurationIntent
Hi there, I'm adding a new widget using the new WidgetConfigurationIntent which takes a number of parameters, including one which conforms to AppEntity. It is defined as an optional. When the user is configuring the widget, after one of the suggested entities is chosen, there is no way to return to a state where this value is nil. Is this possible? I'd like the user to be able to select "None" for this parameter. For now, I'm using a bool to determine whether the AppEntity parameter is used. Thanks!
2
0
1.1k
Oct ’25
[iOS26] Widget Exntension configuration uable to load
I have developed a Widget Extension with editable dynamic options. `struct ModelQuery: EntityStringQuery { public var allModels:[ModelEntity] { // from App Groups UserDefaults let models = SharedDataManager.getModelList() // 检查原始数据是否为空,避免转换后的数据异常 guard !models.isEmpty else { return [] } let entites = models.map{ModelEntity(from: $0)} return entites } func entities(for identifiers: [ModelEntity.ID]) async throws -> [ModelEntity] { let models = allModels if models.isEmpty { return [] } // 尝试匹配ID let matchedEntities = identifiers.compactMap { id in models.first { $0.id == id } } // 如果没有匹配到任何实体,返回默认的第一个站点 if matchedEntities.isEmpty && !models.isEmpty { return [models[0]] } return matchedEntities } func entities(matching string: String) async throws -> [ModelEntity] { let stations = allModels if stations.isEmpty { return [] } if string.isEmpty { return stations } let lowercasedString = string.lowercased() let filteredStations = stations.filter { station in station.name.lowercased().contains(lowercasedString) } if filteredStations.isEmpty { return [] } return filteredStations } func suggestedEntities() async throws -> [ModelEntity] { return allModels } }` Below is how it looks when functioning properly However, when I tested it on iOS 26, occasional "Failed to Load" errors or unknown errors occurred. The same issues did not appear on iOS 17 or iOS 18.
2
0
103
Oct ’25
'openAppWhenRun' property causing AppIntentsExtension to fail
import AppIntents struct AddTodoIntent: AppIntent { static var title: LocalizedStringResource = "Add Todo" static var openAppWhenRun: Bool = true func perform() async throws -> some IntentResult & ProvidesDialog { .result(dialog: "New todo added successfully.") } } struct ViewTodosIntent:AppIntent { static var title: LocalizedStringResource = "View Todos" func perform() async throws -> some IntentResult & ProvidesDialog { .result(dialog: "Here are your todos...") } } struct TodoAppShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: AddTodoIntent(), phrases: ["\(.applicationName) Add a new todo"], shortTitle: "New Todo", systemImageName: "plus.circle" ) AppShortcut( intent: ViewTodosIntent(), phrases: ["\(.applicationName) Show my todoso"], shortTitle: "Show todos", systemImageName: "plus.app" ) } } when we used, it wrong How did i can do it success?
0
0
54
Oct ’25
LiveActivityIntent call perfrom inconsistently
When I set Alarm with fixed schedule(Alarm.Schedule.fixed(date)) LiveActivityIntent just work inconsistently it sometimes call perfrom but cannot call other's such as NotificationCenter.default.post it just work fine with relativeSchedule but not for fixed schedule i want to know why it happen tested code is under below struct StopIntent: LiveActivityIntent { static var supportedModes: IntentModes = [.foreground(.immediate)] func perform() throws -> some IntentResult { guard let id = UUID(uuidString: alarmID) else { NotificationCenter.default.post(name: .Alarm.stoped, object: alarmDataString) throw TestAlarmManager._Error.badAlarmID } Task { @MainActor in try TestAlarmManager.shared.stopAlarm(id) NotificationCenter.default.post(name: .Alarm.stoped, object: alarmDataString) } return .result() } static var title: LocalizedStringResource = "Stop" static var description = IntentDescription("Stop an alert") @Parameter(title: "alarmID") var alarmID: String @Parameter(title: "alarmDataString") var alarmDataString: String init(alarmID: UUID, alarmDataString: String) { self.alarmID = alarmID.uuidString self.alarmDataString = alarmDataString } init() { self.alarmID = "" self.alarmDataString = "" } }
1
0
100
Oct ’25
How to determine whether the current model supports Ghost island
We currently have the need to develop Smart Island. We need to identify whether the current mobile phone supports Smart Island. At present, the solution we can think of is to maintain a model list if the current phone is in the white list, it supports Smart Island. But we think this method is not good enough. Is there a better solution to support identification? In addition, will the later models support smart Island?
0
0
80
Oct ’25
in OS26, X Large circle uses small circle size for the maximum image sizes
Create a static widget kit based widget for watchKit. Use swiftUI and an image. IE on 42mm you can import a 141x141 image at 2x. Import a 141x141 image in the widget and load it in swiftUI. In watchOS 11.x simulator the image will allow up to the size for X Large circles, and on os26, it will not load and complain the image is too large and report the area for the smaller circle, IE 89x89 @ 2x for 41mm Also submitted a "feedback" ticket FB20506200 This is a big issue b/c the size difference for X large circles v the smaller circles is really large. To get existing images to load I am having to resize them down 75-80% on OS26 in the X Large complication.
1
0
67
Oct ’25
ActivityKit - Live Activity countdown needs Wallet - Upgraded Boarding Pass Live Activity-style behavior
Hi, We need Wallet Boarding Pass Live Activity style countdown inside Live Activity. Requirements Show only hours+minutes (no seconds ever). Format examples (Turkish locale concept): T > 60 min: "1sa 14d" (HHh MMm) T < 60 min: "58d" At exactly zero show a single final zero value (e.g. "0d"). Do NOT show seconds or any upward (elapsed) counting after zero. When remaining time < 0 immediately replace display with status text (e.g. "ON TIME"). Never display negative or increasing elapsed time. Discovered Current Timer Methods (Observed) Method 1 (Text(date, style: .relative)): After reaching target it continues counting UP (should stop). Seconds appear automatically once remaining < 1 hour. Method 2 (Text(date, style: .timer)): After reaching target it continues counting UP (should stop). Seconds are always visible from start. Method 3 (Text(timerInterval: Date.now ... targetDate, countsDown: true)): Stops at target (no upward counting) but seconds are always visible; cannot limit to single zero then freeze before status swap. Requested Enhancement Provide a behavior where the countdown displays hours+minutes, renders a single zero-minute value at the boundary (no seconds), then transitions to supplied status text. Request Public API or configuration to: Select displayed units (hours, minutes only). Stop automatic updating after rendering the zero frame (prevent upward counting). Prevent post-target elapsed counting (no positive re-growth). Allow immediate swap-to-text after zero (remaining < 0) while permitting a single zero display at the boundary. Why Align UX with Wallet; need predictable single zero then status, no seconds, no elapsed confusion. Thank you.
0
0
52
Oct ’25
Can you use `JSONDecoder` for decoding your attributes and contentState
Watching WWDC video: https://developer.apple.com/videos/play/wwdc2023/10185/?time=481 It says: So when encoding your content state, do not set any custom encoding strategies. Otherwise, your JSON will be mismatched, and the system will fail to update your Live Activity So I'm just wondering if using JSONDecoder is allowed for decoding apps payloads for the UI of a Live Activity? Or is there a performance hit for this?
0
0
71
Oct ’25
Widget with Core Data guidance
I have an app that has a Core Data store for dates with descriptions that I'd like to present in a widget with countdown calculations. In the app I have a button that just equates an active calculation to the currently selected item in the database (using an EnvironmentObject). I gather I can't use this mechanism inside a widget, right? The user could put tons of items into the database - so I'm sure I don't want to have an editable widget allowing them to pick. I suppose I could create an intent and allow an independent entering from the app - but that seems rather user hostile since they've already entered it for the app - and I'm still trying to support iOS15 which doesn't support that. I did create an App Group and have the Core Data store available from within the widget, but I don't see how to allow the user to choose which date is active. I also want multiple widgets to be able to point to different dates. Any help would be appreciated. Thanks!
3
0
269
Oct ’25
App Intent Parameter (AppEntity) not registering
I'm currently testing this on a physical device (12 Pro Max, iOS 26). Through shortcuts, I know for a fact that I am able to successfully trigger the perform code to do what's needed. In addition, if I just tell siri the phrase without my unit parameter, and it asks me which unit, I am able to, once again, successfully call my perform. The problem is any of my phrases that I include my unit, it either just opens my application, or says "I can't understand" Here is my sample code: My Entity: import Foundation import AppIntents struct Unit: Codable, Identifiable { let nickname: String let ipAddress: String let id: String } struct UnitEntity: AppEntity { static var typeDisplayRepresentation: TypeDisplayRepresentation { TypeDisplayRepresentation( name: LocalizedStringResource("Unit", table: "AppIntents") ) } static let defaultQuery = UnitEntityQuery() // Unique Identifer var id: Unit.ID // @Property allows this data to be available to Shortcuts, Siri, Etc. @Property var name: String // By not including @Property, this data is NOT used for queries. var ipAddress: String var displayRepresentation: DisplayRepresentation { DisplayRepresentation( title: "\(name)" ) } init(Unit: Unit) { self.id = Unit.id self.ipAddress = Unit.ipAddress self.name = Unit.nickname } } My Query: struct UnitEntityQuery: EntityQuery { func entities(for identifiers: [UnitEntity.ID]) async throws -> [UnitEntity] { print("[UnitEntityQuery] Query for IDs \(identifiers)") return UnitManager.shared.getUnitUnits() .map { UnitEntity(Unit: $0) } } func suggestedEntities() async throws -> [UnitEntity] { print("[UnitEntityQuery] Request for suggested entities.") return UnitManager.shared.getUnitUnits() .map { UnitEntity(Unit: $0) } } } UnitsManager: class UnitManager { static let shared = UnitManager() private init() {} var allUnits: [UnitEntity] { getUnitUnits().map { UnitEntity(Unit: $0) } } func getUnitUnits() -> [Unit] { guard let jsonString = UserDefaults.standard.string(forKey: "UnitUnits"), let data = jsonString.data(using: .utf8) else { return [] } do { return try JSONDecoder().decode([Unit].self, from: data) } catch { print("Error decoding units: \(error)") return [] } } func contactUnit(unit: UnitEntity) async -> Bool { // Do things here... } } My AppIntent: import AppIntents struct TurnOnUnit: AppIntent { static let title: LocalizedStringResource = "Turn on Unit" static let description = IntentDescription("Turn on an Unit") static var parameterSummary: some ParameterSummary { Summary("Turn on \(\.$UnitUnit)") } @Parameter(title: "Unit Unit", description: "The Unit Unit to turn on") var UnitUnit: UnitEntity func perform() async throws -> some IntentResult & ProvidesDialog { //... My code here } } And my ShortcutProvider: import Foundation import AppIntents struct UnitShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: TurnOnUnit(), phrases: [ "Start an Unit with \(.applicationName)", "Using \(.applicationName), turn on my \(\.$UnitUnit)", "Turn on my \(\.$UnitUnit) with \(.applicationName)", "Start my \(\.$UnitUnit) with \(.applicationName)", "Start \(\.$UnitUnit) with \(.applicationName)", "Start \(\.$UnitUnit) in \(.applicationName)", "Start \(\.$UnitUnit) using \(.applicationName)", "Trigger \(\.$UnitUnit) using \(.applicationName)", "Activate \(\.$UnitUnit) using \(.applicationName)", "Volcano \(\.$UnitUnit) using \(.applicationName)", ], shortTitle: "Turn on unit", systemImageName: "bolt.fill" ) } }
1
0
81
Oct ’25