I tested it on the app I work with and others I use and the notification message is not appearing when using sleep mode.
Someone knows something about this, and if it is mapped for correction?
Iphone: 13 mini IOS: 18.4.1
Widgets & Live Activities
RSS for tagDiscuss how to manage and implement Widgets & Live Activities.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have implemented a Live Activity that includes two buttons. Currently, both buttons utilize deep links to open the main application, where I then detect the URL to perform the corresponding action.
My primary question is:
Is it possible to update a button's title and/or color within a Live Activity without requiring the main application to open?
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
I need to implement a VPN connection from the ios 17 widget without opening the main application. (I have seen such an implementation in other applications) How can this be implemented?
Does live activity require notification permission? If you need to update card data through APNS, I remember that it was required in the past, otherwise the card could not be created. This year I tried it and some apps did not have notification permission, but they could also use live activity and update data
We are developing a service that uses the “More Frequent Updates” feature of Live Activities.
I have a question regarding the push notification budget for Live Activities.
According to the documentation and the following session:
WWDC23 Session 10185 – “What’s New in ActivityKit”
https://developer.apple.com/videos/play/wwdc2023/10185/
At 11:58, it is stated that there is no limit on the number of updates when using low priority (5).
Could you confirm whether updates sent with low priority (5) are indeed not subject to the Live Activity push notification budget?
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
See the image there the clock is stopped but on right on the top time is different
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
I've turned on Swift 6 language mode and noticed that during runtime Xcode gives this warning for a new widget (iOS 17.2):
warning: data race detected: @MainActor function at TestWidgetExtension/TestWidget.swift:240 was not called on the main thread
struct TestWidget: Widget {
let kind: String = "TestWidget"
var body: some WidgetConfiguration {
AppIntentConfiguration(
kind: kind,
intent: ConfigurationAppIntent.self,
provider: Provider()
) { entry in // LINE 240
TestWidgetEntryView(entry: entry)
.containerBackground(Color.white, for: .widget)
}
}
}
Is there any way to solve this on my side?
Thank you!
body: error when I run the app,and the frame just became freezed.
I have an AppIntent that edits an object in my app. The intent accepts an app entity as a parameter, so if you run the intent it will ask which one do you want to edit, then you select one from the list and it shows a dialog that it was edited successfully. I use this same intent in my Home Screen widget initializing it with an objectEntity. The code needs to run in the app's process, not the widget extension process, so the file is added to both targets and it conforms to ForegroundContinuableIntent, and that is supposed to ensure it always runs in the app process. This works great when run from the Shortcuts app and when involved via a button in the Home Screen widget, exactly as expected. Here is that app intent:
@available(iOS 17.0, *)
struct EditObjectIntent: AppIntent {
static let title: LocalizedStringResource = "Edit Object"
@Parameter(title: "Object", requestValueDialog: "Which object do you want to edit?", inputConnectionBehavior: .connectToPreviousIntentResult)
var objectEntity: ObjectEntity
init() {
print("INIT")
}
init(objectEntity: ObjectEntity) {
self.objectEntity = objectEntity
}
@MainActor
func perform() async throws -> some IntentResult & ReturnsValue<ObjectEntity> & ProvidesDialog {
// Edit the object from objectEntity.id...
return .result(value: objectEntity, dialog: "Done")
}
}
@available(iOS 17.0, *)
@available(iOSApplicationExtension, unavailable)
extension EditObjectIntent: ForegroundContinuableIntent { }
I now want to create a ControlButton that uses this intent:
struct EditObjectControlWidget: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: "EditObjectControlWidget") {
ControlWidgetButton(action: EditObjectIntent()) {
Label("Edit Object", systemImage: "pencil")
}
}
}
}
When I add the button to Control Center and tap it (on iOS 18), init is called 3x in the app process and 2x in the widget process, yet the perform function is not invoked in either process. No error appears in console logs for the app's process, but this appears for the widget process:
LaunchServices: store <private> or url <private> was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=72, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
Attempt to map database failed: permission was denied. This attempt will not be retried.
Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=72, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler}
What am I doing wrong here? Thanks!
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
iOS
SwiftUI
WidgetKit
App Intents
WatchOS26 ControlWidget cannot display image copy or click
import Foundation
import SwiftUI
import WidgetKit
import AppIntents
internal import Combine
struct WidgetToggle: ControlWidget {
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: "com.example.myApp.performActionButton", provider: TimerValueProvider()) { isRunning in
ControlWidgetToggle("WidgetToggle", isOn: isRunning, action: ToggleTimerIntent()) { isOn in
Label(isOn ? "Running" : "Stopped", systemImage: isOn ? "hourglass.bottomhalf.filled" : "hourglass")
}
}
.displayName("WidgetToggle")
.description("WidgetToggle description")
}
}
struct TimerValueProvider: ControlValueProvider {
var previewValue: Bool {
return false
}
func currentValue() async throws -> Bool {
return TimerManager.shared.isRunning
}
}
struct ToggleTimerIntent: SetValueIntent {
static var title: LocalizedStringResource = "WidgetToggle"
@Parameter(title: "Toggle")
var value: Bool
func perform() async throws -> some IntentResult {
TimerManager.shared.isRunning = value
return .result()
}
}
class TimerManager: ObservableObject {
static let shared = TimerManager()
@Published var isRunning = false
}
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
I am developing Live Activities using Swift. The same code can display the lock screen view and Dynamic Island on most devices, but on one specific iPhone 16 Pro Max, the Dynamic Island is not shown. The system version is iOS 18.0. However, other apps on this phone can display the Dynamic Island normally. How should I troubleshoot the issue? Can anyone help me? Thank you.
我们在使用clip轻应用功能,在App Store Connect中配置了高级轻应用体验,并配置了相关的https链接(在构建版本页面此域名是已验证状态),但是我们在使用此链接进行NFC触碰时,不会拉起来clip轻应用,只会显示“XXXX NFC标签”,使用Apple的官方链接:https://appclip.apple.com/id?p=xxxx,是可以拉起来轻应用的,请问各位大佬,我们的问题出现在哪?该如何解决?
https://developer.apple.com/watchos/whats-new/
Is there an example demo available
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
When updating from beta 1 to beta 2, CarPlay now only shows 1 column instead of the two or three that were in beta 1.
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
I have implemented the logic to display live activity with push notification. As of now, only in the foreground only, the live activity is getting triggered.
For background, it is displaying some times and for killed state, it is not even trying to trigger.
I'm currently working on enhancing our app’s support for App Intents. We're aiming to suggest time-sensitive shortcuts to Spotlight and Siri — for example, proactively surfacing certain shortcut from 2 hours before some event the user has registered in their database until 2 hour after that.
I’ve been reviewing the AppIntents framework documentation but haven’t found a definitive answer on whether this is currently achievable.
From what we understand, the RelevantIntent and RelevantContext APIs appear to support time-based suggestions, but they seem to apply only to Widgets, not to standalone app shortcuts. Is this understanding correct, and is there a recommended approach for achieving time-sensitive shortcut suggestions outside of a Widget context?
Any guidance would be greatly appreciated.
Best regards,
Hi Everyone. I wanna run the live activity in terminated state. I have implemented the push notification flow which is working fine in foreground and background state. In the terminated state, the push to start token is not getting generated. How to make it work?
Hi everyone and Apple support,
I’ve built an app that continuously runs and receives temperature data from a sensor. When a threshold is reached, I use Live Activities with the push notification flow to display alerts on the Dynamic Island. The Live Activity and push notification flow work fine in foreground and background states. However, I’m trying to support push-triggered Live Activities when the app is in the terminated state. Since my app rarely terminates, I can’t confirm if the Live Activity push token is generated in that state. It seems like it isn’t, which blocks the Live Activity from starting via push. I tried with both pushtostarttoken and pushtostarttokenupdates. None of them worked.
Has anyone dealt with this or found a workaround to ensure the push token is available even when the app is terminated?
I am trying to update a widget with a push notification.
After completing all the settings, I sent a push notification via command line and got the following error:
Connection #0 to host api.sandbox.push.apple.com left intact
{"reason":"DeviceTokenNotForTopic"}
The platform is VisionOS.
I am trying to feature flag widgets in my Widget extension. This feature flag value is stored remotely, read by my main app, and written to UserDefaults, then read from UserDefaults in my widget target. I understand that providing an empty array of WidgetFamilys will not show my app when the user goes to add a widget.
However, even when this flag flips to true, hard-closing and reopening my app will not show my app in the list of apps you can add a widget for. But I notice that if I recompile my app from Xcode (running the app's scheme, not the widget scheme), then my app will show when you search for an app to add a widget for, making me think that these Widget objects are only created by the system once when the app is initially installed/updated.
My concern is that I will not be able to flip this flag from false to true after the user has installed my app to do a rollout of my widget. Is this expected? Or is there an alternative or otherwise recommended way of doing this?
struct MyWidget: Widget {
let kind = "MyWidget"
var supportedFamilies: [WidgetFamily] {
let manager = ExtensionManager()
if manager.widgetsEnabled {
return [.systemSmall, .systemMedium, .systemLarge]
}
else {
return []
}
}
var body: some WidgetConfiguration {
IntentConfiguration(
kind: kind,
intent: MyWidgetIntent.self,
provider: MyWidgetProvider()
) { entry in
MyWidgetView(entry: entry)
}
.configurationDisplayName("My Widget")
.description("Install my widget!")
.supportedFamilies(supportedFamilies)
}
}