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

Created

privacySensitive on lockScreen does not seem to work...
Documentation seems to say that privacySensitive is supposed to redact on the lockScreen. I've disabled "Allow Access when locked" for "Lock Screen Widgets" just in case. It does not work for me. If I add "redacted(reason:) into the view hierarchy it redacts all the content all the time including on the home screen. I've read articles. I gone through a lot of documentation. None of them seem to give the magic formula for redacting sensitive content on the lock screen. I'm using iOS 18.7 on a real iPhone 14 Pro Max.
1
0
127
Sep ’25
Unable to activate ActiveKit
Appears during code compilation Provisioning profile "iOS Team Provisioning Profile: ..*" doesn't include the com.apple.developer.ActivityKit entitlement, Has anyone encountered or resolved a similar issue where the ActiveKit feature was not found in the developer's identifier, despite not being activated in the developer's system?
1
1
74
Sep ’25
Unable to activate ActivityKit
Appears during code compilation Provisioning profile "iOS Team Provisioning Profile: ..*" doesn't include the com.apple.developer.ActivityKit entitlement, Has anyone encountered or resolved a similar issue where the ActiveKit feature was not found in the developer's identifier, despite not being activated in the developer's system?
0
1
54
Sep ’25
Unable to activate ActivityKit
Appears during code compilation Provisioning profile "iOS Team Provisioning Profile: ..*" doesn't include the com.apple.developer.ActivityKit entitlement, Has anyone encountered or resolved a similar issue where the ActiveKit feature was not found in the developer's identifier, despite not being activated in the developer's system?
1
0
63
Sep ’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
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
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
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
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
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
[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
Live Activities Push-to-Start flows
Good morning, We are implementing Live Activities in a push-to-start flow. We wrap the listener for push to start tokens in a high priority task: if ptsListenerTask == nil || ptsListenerTask?.isCancelled == true { ptsListenerTask = Task(priority: .high) { [weak self] in for await pushToken in Activity<LiveAuctionAttributes>.pushToStartTokenUpdates { //Send token to back-end } } I've tried a few variations of this and they work well on most devices. I have seen a couple of devices that refuse to issue a push to start token. The user will have logging for the init flow and starting the PTS listener then the logs just go silent, nothing happens. One thing that seemed to work was getting the user to start a Live Activity manually (from our debugging tool) then the PTS token gets issued. This is not very reliable and working a mock live activity into the flow for obtaining a PTS token is a poor solution. Is anyone else seeing this and is there a known issue with obtaining PTS tokens? Thanks! Brad
8
1
204
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
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
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
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
65
Nov ’25
watchOS: AppIntents.IntentRecommendation description ignored when applying a .watchface
When we use AppIntents to configure WidgetKit complications, the description we provide in IntentRecommendation is ignored after applying a .watchface file that includes those intent configurations. In the Watch app, under Complications, the labels shown next to each slot do not match the actual complications on the face—they appear to be the first strings returned by recommendations() rather than the selected intent configuration. Steps to Reproduce Create an AppIntent used by a WidgetKit complication (e.g., .accessoryRectangular). Provide multiple intent recommendations with distinct descriptions: struct SampleIntent: AppIntent { static var title: LocalizedStringResource = "Sample" static var description = IntentDescription("Sample data") @Parameter(title: "Mode") var mode: String static func recommendations() -> [IntentRecommendation<Self>] { [ .init(intent: .init(mode: "A"), description: "Complication A"), .init(intent: .init(mode: "B"), description: "Complication B"), .init(intent: .init(mode: "C"), description: "Complication C") ] } func perform() async throws -> some IntentResult { .result() } } Add two of these complications to a Modular Duo face (or any face that supports multiple slots), each with different intent configurations (e.g., A in one slot, B in another). Export/share the face to a .watchface file and apply it on another device. Open the Watch app → the chosen face → Complications. Expected Each slot’s label in Complications reflects the specific intent configuration on the face (e.g., “Complication A”, “Complication B”), matching what the complication actually renders. Actual The labels under Complications do not match the visible complications. Instead, the strings shown look like the first N items from recommendations(), regardless of which configurations are used in each slot. Notes The complications themselves render correctly on-watch; the issue is the names/labels displayed in the Watch app UI after applying a .watchface. Filed Feedback: FB20915258
3
3
112
4w