body: error when I run the app,and the frame just became freezed.
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'm trying to update data displayed in my Watch Complications (WidgetKit). I have an iOS app that sends data to the Apple Watch using WCSession.default.transferUserInfo. However, the data only updates on the complications or widgets after I open the watchOS app manually.
Ideally, I'd like the Watch widget/complication to reflect the updated data as soon as it's sent from the iPhone, without requiring the user to open the Watch app.
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
Watch Connectivity
WatchKit
Watch Complications
In WatchOS 26 you can now configure Apple Watch Widgets that use AppIntents instead of having a preconfigured option via AppIntentRecommendation.
This is demonstrated in the Weather Details Widget. In that, the Intent has been set up such that the options have icons for each parameter.
How can I update my Intent code to offer this?
struct DataPointsWidgetIntent: AppIntent, WidgetConfigurationIntent {
static var title: LocalizedStringResource = "Data Points Widget Configuration"
static var description = IntentDescription("Configure the individual data point display for Widgets.")
static var isDiscoverable: Bool { return false}
init() {}
func perform() async throws -> some IntentResult {
print("DataPointsWidgetIntent perform")
return .result()
}
@Parameter(title: "Show Individual Data Points", default: true)
var showDataPoints: Bool?
@Parameter(title: "Trend Timescale", default: .week)
var timescale: TimescaleTypeAppEnum?
static var parameterSummary: some ParameterSummary {
Summary("Test Info") {
\.$showDataPoints
\.$timescale
}
}
}
enum TimescaleTypeAppEnum: String, AppEnum {
case week
case fortnight
static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Trend Timescale")
static var caseDisplayRepresentations: [Self: DisplayRepresentation] = [
.week: "Past Week",
.fortnight: "Past Fortnight"
]
}
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
WidgetKit
Intents
WeatherKit
App Intents
Hello,
I'm currently developing for visionOS using Xcode's latest beta version.
I have a question regarding Widget Previews for visionOS 26:
When I create a new Widget Extension target directly from a visionOS project, the generated code does not include the #Preview macro.
Following the documentation, I manually added the #Preview macro to a Widget created within a visionOS project, but Xcode then displays an error stating that "This platform does not support previewing widgets."
My interpretation is that Widget Previews are currently not supported for Widgets created specifically for visionOS in this beta version. Is this understanding correct? Or am I missing a specific way to implement previews for visionOS Widgets, or is there a particular project setting I might have overlooked?
Any clarification or guidance on this matter would be greatly appreciated.
Thank you.
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
Xcode Previews
WidgetKit
visionOS
I am experiencing an issue with my watchOS app. My application updates a shared file, accessible by both the main app and the WidgetKit extension, during a WatchConnectivity background task. Following this update, I call reloadAllTimelines().
This functionality worked as expected on watchOS 10, even without Developer Mode enabled. However, after updating my device to watchOS 11.5, this API appears to be broken.
My reasons for believing this API is broken are threefold:
The functionality worked reliably on watchOS 10.
On watchOS 11.5, enabling "WidgetKit Developer Mode" (found under Settings > Developer) resolves the issue, and my complications update correctly.
When I enter watch face edit mode, the snapshot/preview displayed (which utilizes the same underlying logic as the timeline API) shows the correct data. This indicates that the data has been successfully received from the phone, and the widget is indeed reading the updated shared file. Despite this, the actual widget view during its resting phase never updates.
It's worth noting that TimelineReloadPolicy functions as expected, but I cannot rely on this for my use case. My widget requires immediate updates upon receiving new data.
Apple, please investigate this behavior.
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
Watch Connectivity
watchOS
Watch Complications
WidgetKit
I have a Health & Fitness widget that runs on iPhone and Apple Watch. As Health data access requires the device to be unlocked, the iPhone widget is already slightly limited in capability because of updates.
With widgets further expanding to places like CarPlay, I know I can use the .disfavouredLocations{} API to try and prevent it being offered there. This is crucial as the widget functionality would be basically non-existent as your device is locked during CarPlay use.
My problem is, on the Mac despite using the .disfavouredLocations{.iPhoneWidgetsOnMac} etc...., the widget can still be added in the "other unsupported section". And yet, in that section the Apple Fitness app widget is no where to be seen. Is there an API I am missing to completely remove a widget from the Mac widget gallery and hopefully CarPlay, Standby etc.... (all places where the device running the widget is usually locked -> No Health data)?
Or does the Apple Fitness app have a private API to block it from these places where its function is not wanted and this isn't available to other apps?
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
Hello,
I'm working with Live Activities and noticed that sometimes an activity transitions to .dismissed, even though the user hasn't manually swiped it away and system conditions appear to be completely normal — such as:
The activity is still within its intended 8-hour lifetime
The battery level is high
The app is active or recently active
The activity is lightweight (not using frequent updates)
According to the ActivityKit documentation:
/// The Live Activity ended and is no longer visible because a person or the system removed it.
case dismissed
This doesn’t clarify why the system would dismiss an activity when all conditions seem fine.
Additional context:
When reviewing system logs via Console.app, we’re seeing messages such as:
liveactivitiesd Removing activity from replicator: 381F3DDC-585B-4021-B075-548606F543DA for relationship IDs: [C7AB9C2A-49DD-43FC-BB58-D768ECF9D354]
This suggests that the system is actively removing the activity, but there’s no API or reason provided that helps us understand why this is happening.
Questions:
What are the system-level triggers that could cause a Live Activity to be dismissed under normal conditions?
Is there a known set of heuristics (e.g., memory pressure, resource constraints) that might apply?
Is there a way to distinguish between system-triggered dismissal and user-initiated swipe-to-dismiss?
Any best practices to reduce the likelihood of unexpected system removal?
This is especially important for our use case, where users rely on Live Activities to view real-time flight and boarding information — and losing the activity unexpectedly negatively affects user experience.
Thanks in advance for any insight!
Hello forum,
I want to keep my app running in the background after user swaps up, for the purpose of workout tracking.
start up the task and continuously receipt GPS updates
process the location data
show the data on a live activity
Two examples
Strava
paddlelogger
Question:
Does this mean, these two apps would just pause when the .backgroundTimeRemaining becomes 0?
How does a workout app "work" in background mode, do I need to handle budget running out?
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
Core Location
Maps and Location
Background Tasks
Hello,
I'm trying to create a widget using the WidgetKit framework. In this part, I'm using Intents along with a DynamicOptionsProvider. As shown in the Medium article below, I want to present multiple options when "Edit Widget" is tapped:
https://levelup.gitconnected.com/swiftui-configurable-widget-to-let-our-user-choose-4a54e398f42f
However, in this example, the options are provided statically. What I want to achieve is to display a list of devices based on the selected HomeId after the user selects a Home. I’ve set up the interface accordingly, but when I select a Home, the device list does not update.
How can I make this work? The two options should be dependent on each other.
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
Project structure is:
App target + widget extension + widget intent extension
All share a common appgroup group.com.x.y and all file handling is done using
FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.com.x.y")
so that only the shared container is used.
Using the Main app target, a font "Chewy-Regular.ttf" is downloaded and saved to the shared AppGroup container.
Font can now be loaded via
CTFontManagerRegisterFontsForURL
and displayed in a Main App Text view
Text("Testing...").font(Font.custom("Chewy-Regular", size: 20))
Now add a Widgetkit widget instance that uses this font.
In 'getTimeLine() and getSnapShot() of IntentTimelineProvider we load the font again via CTFontManagerRegisterFontsForURL (this needs to happen again probably because widget runs in a separate process from the main app?).
On simulator, the widget will show the correct font.
BUT
On iPhone7 real device, the widget will show the 'redacted placeholder view'. It seems that something is crashing.
I see in the device console :
error 14:39:07.567120-0800 chronod No configuration found for configured widget identifier: D9BF75EE-4A04-441A-8C85-1507F7ECE379
fault 14:39:07.625600-0800 widgetxExtension -[EXSwiftUI_Subsystem beginUsing:withBundle:] unexpectedly called multiple times.
error 14:39:07.672733-0800 chronod Encountered an error reading the view archive for <private>; error: <private>
error 14:39:07.672799-0800 chronod [co.appevolve.onewidget.widgetx:widgetx:small:1536744920620481560@148.0/148.0/20.2] reload: could not decode view
error 14:39:07.674984-0800 kernel Sandbox: chronod(2128) deny(1) file-read-metadata /private/var/mobile/Containers/Shared/AppGroup/9B524570-1765-4C24-9E0C-15BC3982F0DC/downloadedFonts/Chewy/Chewy-Regular.ttf
error 14:39:07.675762-0800 kernel Sandbox: chronod(2128) deny(1) file-read-data /private/var/mobile/Containers/Shared/AppGroup/9B524570-1765-4C24-9E0C-15BC3982F0DC/downloadedFonts/Chewy/Chewy-Regular.ttf
error 14:39:07.708914-0800 chronod [u 8D2C83B3-A6CB-432E-A9D4-9BC8F7056B10:m (null)] [<private>(<private>)] Connection to plugin invalidated while in use.
fault 14:39:07.710284-0800 widgetxExtension -[EXSwiftUI_Subsystem beginUsing:withBundle:] unexpectedly called multiple times.
error 14:39:07.803468-0800 chronod Encountered an error reading the view archive for <private>; error: <private>
It seems that it's a permission issue, and the textview can't access the font file it needs when the widget is rendering.
Notes:
1) Font is definitely registered because I can see them in
for fontFamily in UIFont.familyNames {
for fontName in UIFont.fontNames(forFamilyName: fontFamily) {
print(fontName)
								...
in both the Main App target and the Widget Extension target
2) If I make make the font part of the app bundle and add to 'Fonts provided by application' , the are loaded absolutely fine in the Main App and the Widget on simulator and iPhone 7 real device.
3) I do see this error sometimes in the Widget extension target log, don't know if it's related.
widgetxExtension[1385:254599] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x28375b880> (Domain: group.co.appevolve.onewidget, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
4) I suspected something to do with app groups, so I tried to copy the font into the Widget Extension container and load from there, but had the same result.
Please help! Thank you.
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
iOS
WidgetKit
Typography
SwiftUI
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
Confusion
Based on the fact that the subscription is requested on a Activity type, I assumed that the push-to-start tokens would be different. But the push-to-start token for WidgetExtensionAttributes and WidgetExtensionAttributesOther were identical. This is misleading.
The code below prints identical tokens even though the name of the token and their underlying schema are different.
Code Sample
func getTokens() {
Task {
if let data = Activity<func getTokens() {
Task {
if let data = Activity<WidgetExtensionAttributes>.pushToStartToken {
print("exists:", data.hexadecimalString)
} else {
print("requesting pushToStartToken")
for await ptsToken in Activity<WidgetExtensionAttributes>
.pushToStartTokenUpdates {
let ptsTokenString = ptsToken.hexadecimalString
print("new:", ptsTokenString)
}
}
}
Task {
if let data = Activity<WidgetExtensionAttributesOther>.pushToStartToken {
print("other exists:", data.hexadecimalString)
} else {
print("other requesting pushToStartToken")
for await ptsToken in Activity<WidgetExtensionAttributesOther>
.pushToStartTokenUpdates {
let ptsTokenString = ptsToken.hexadecimalString
print("other new:", ptsTokenString)
}
}
}
}>.pushToStartToken {
print("exists:", data.hexadecimalString)
} else {
print("requesting pushToStartToken")
for await ptsToken in Activity<WidgetExtensionAttributes>
.pushToStartTokenUpdates {
let ptsTokenString = ptsToken.hexadecimalString
print("new:", ptsTokenString)
}
}
}
Task {
if let data = Activity<WidgetExtensionAttributesOther>.pushToStartToken {
print("other exists:", data.hexadecimalString)
} else {
print("other requesting pushToStartToken")
for await ptsToken in Activity<WidgetExtensionAttributesOther>
.pushToStartTokenUpdates {
let ptsTokenString = ptsToken.hexadecimalString
print("other new:", ptsTokenString)
}
}
}
}
Activity Types
struct WidgetExtensionAttributesOther: ActivityAttributes {
public struct ContentState: Codable, Hashable {
var age: Int
}
var addresses: [String]
}
struct WidgetExtensionAttributes: ActivityAttributes {
public struct ContentState: Codable, Hashable {
var emoji: String
}
var name: String
}
Docs
After much investigation I noticed the wording of the docs kind of hint that the push-to-start token is per ActivityKit as it says:
An asynchronous sequence you use to observe changes to the token for starting a Live Activity with an ActivityKit push notification.
But docs and the API don't align well.
Questions
Is it correct that the push-to-start token is per app? If so then is there a reason that that API designers decided to still have to pass a specific type and not just make a request without passing a type?
Should I maybe file a radar?
Is it correct to say push-to-start is per app, while update tokens are per instance. i.e. if I have two soccer matches, then unless the push-to-start token was refreshed by the OS, then both would use the same push-to-start token, however each match would have a unique update token?
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?
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 tested it on the app I work with and others I use and the notification message is not appearing when using sleep mode
Iphone: 13 mini
IOS: 18.4.1
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
I am seeing a really weird behavior with Live Activities. The Live Activity is always appearing on the simulator. However the Live Activity is only appearing on my physical device when there is no other widget in the widget bundle shown below.
@main
struct HoerspielWidgetsBundle: WidgetBundle {
var body: some Widget {
// Uncomment the line below and the Live Activity will no longer appear
// UpNextWidget()
PlaybackLiveActivity()
}
}
Annotating that var with @WidgetBundle has no effect.
There are no logs indicating an error, the function to request a Live Activity does not throw and the status of the activity is active.
Both the widget and the Live Activity are working fine otherwise. NSSupportsLiveActivities is set to true in the correct Info.plist file. I am not running any beta software and the physical iPhone is on the newest version (iOS 18.5). Using the template when adding a new target in Xcode, I was able to set up a similar app where the Live Activity works as expected.
I am really at a loss here which additional information I should provide or how this issue can be resolved.
Thank you for your help.
I've noticed that the when starting live activities via a remote push-to-start notification, the live activity widget consistently succeeds in displaying on the lock screen. However push-to-update token is not always received by the task observing the pushTokenUpdates async-sequence.
Task {
print("listening for pushTokenUpdates")
for await pushToken in activity.pushTokenUpdates {
let token = pushToken.map {String(format: "%02x", $0)}.joined()
print("Push token: \(token)")
}
}
The log will print "listening for pushTokenUpdates" however occasionally the "Push token: ___" line will not be present even when the widget has displayed on screen. This happens even if the "allow" button has been selected on live activities for that app. The inconsistent behavior leads me to believe there is an issue at the ActivityKit level. Would appreciate any feedback in debugging this!