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.
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
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?
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
My widget has a background color set, but after the system sets custom transparency, my widget displays a blank space. I would like to solve this problem by obtaining the system's custom transparency settings and then setting the background color transparency, or do you have a better way to solve this problem
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
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 = ""
}
}
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?
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.
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!
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.
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.
Im having trouble enabling Live Activities in a new app. The option is not available in Xcode or in the developer portal. Is there something I have to do to activate this option?
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
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.
I don't see any where how to make my payment
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
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,
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.
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
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?
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~
iPhone 16.0 16.0.2 系统上运行小组件出现问题, 其他系统没有问题
SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget 'com.jiduauto.iphone.jdcomiphoneWidget' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=5 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedDescription=The request to open "com.apple.springboard" failed., NSLocalizedFailureReason=Unexpected error type., NSUnderlyingError=0x600002bbd7a0 {Error Domain=BSServiceConnectionErrorDomain Code=3 "XPC error received on message reply handler" UserInfo={BSErrorCodeDescription=OperationFailed, NSLocalizedFailureReason=XPC error received on message reply handler}}, BSErrorCodeDescription=InvalidResponse}." UserInfo={NSLocalizedDescription=Failed to show Widget 'com.jiduauto.iphone.jdcomiphoneWidget' error: Error Domain=FBSOpenApplicationServiceErrorDomain Code=5 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedDescription=The request to open "com.apple.springboard" failed., NSLocalizedFailureReason=Unexpected error type., NSUnderlyingError=0x600002bbd7a0 {Error Domain=BSServiceConnectionErrorDomain Code=3 "XPC error received on message reply handler" UserInfo={BSErrorCodeDescription=OperationFailed, NSLocalizedFailureReason=XPC error received on message reply handler}}, BSErrorCodeDescription=InvalidResponse}., NSUnderlyingError=0x600002bbd5f0 {Error Domain=FBSOpenApplicationServiceErrorDomain Code=5 "The request to open "com.apple.springboard" failed." UserInfo={NSLocalizedDescription=The request to open "com.apple.springboard" failed., NSLocalizedFailureReason=Unexpected error type., NSUnderlyingError=0x600002bbd7a0 {Error Domain=BSServiceConnectionErrorDomain Code=3 "XPC error received on message reply handler" UserInfo={BSErrorCodeDescription=OperationFailed, NSLocalizedFailureReason=XPC error received on message reply handler}}, BSErrorCodeDescription=InvalidResponse}}}
Domain: DTXMessage
Code: 1
User Info: {
DVTErrorCreationDateKey = "2024-02-19 08:02:14 +0000";
}
System Information
macOS Version 13.5.2 (Build 22G91)
Xcode 15.0 (22265) (Build 15A240d)
Timestamp: 2024-02-19T16:02:14+08:00
I submitted a Feedback FB19925261 with a demo project two months ago, but it’s still marked as Open. The issue still persists in Xcode 26.1 + watchOS 26.1. Could someone kindly take a look at the status of this Feedback?
For our Live Activity Tokens, when we fire a payload, often apns is returning a response of 410 unregistered.
Docs are saying:
The device token is inactive for the specified topic. There is no need to send further pushes to the same device token, unless your application retrieves the same device token, refer to Registering your app with APNs
Questions:
Why does this happen? Does it only happen because the user changed their permission? Or there are other reasons?
And when it does happen, what should we do about it?
A. Should we keep the token on the server? Because perhaps the user will change their permission and the token becomes valid? That could leave us with lots of invalid tokens and us firing at them unnecessarily.
Docs do say:
Don’t retry notification responses with the error code BadDeviceToken, DeviceTokenNotForTopic, Forbidden, ExpiredToken, Unregistered, or PayloadTooLarge.
B. Or should we remove the token from the server? That then requires app to re-register the token. But the problem with that is:
When I went into App's settings from OS settings and toggled push notifications to on, the app was not launched into the background nor killed i.e. it requires explicit app launch by the user to re-register itself which isn't ideal...
It means a user may turn on notifications from the OS settings and then assume that their push notifications should be back in business, but that won't happen if you toggle things from OS settings.
Hey!
I'm working on enabling remotely started live activities. I'm running into 2 crashes:
Upon initializing ActivityAuthorizationInfo
Upon calling Activity<...>.activities array
Both stack traces look like this:
0 libsystem_kernel.dylib +0xce0 _mach_msg2_trap
1 libsystem_kernel.dylib +0x4398 _mach_msg2_internal
2 libsystem_kernel.dylib +0x42b4 _mach_msg_overwrite
3 libsystem_kernel.dylib +0x40fc _mach_msg
4 libdispatch.dylib +0x1cc04 __dispatch_mach_send_and_wait_for_reply
5 libdispatch.dylib +0x1cfa4 _dispatch_mach_send_with_result_and_wait_for_reply
6 libxpc.dylib +0x107ec _xpc_connection_send_message_with_reply_sync
7 BoardServices +0xaea8 -[BSXPCServiceConnectionMessage _sendWithMode:]
8 BoardServices +0x17938 -[BSXPCServiceConnectionMessage sendSynchronouslyWithError:]
9 BoardServices +0xeef0 ___71+[BSXPCServiceConnectionProxy createImplementationOfProtocol:forClass:]_block_invoke
They happen to a limited number of users, but not insignificant. Most are on iOS 18.6.2 and iOS 26.1, but there are others in the mix. I don't have a repro myself. It looks like the main thread gets blocked after we receive no response from these ActivityKit APIs. Both of these are called inside application:didFinishLaunchingWithOptions:.
For ActivityAuthorizationInfo, we need the app to communicate with the server whether the user has live activities enabled; hence, calling this object's init as early as possible in the app.
For activities array, I'd like to do some logging whenever the live activity is started or ended (for example, if activities array no longer contains any activities, we can log the activity as dismissed). For this logging to happen, as far as I understand, it has to happen inside didFinishLaunchingWithOptions since this is the only method being called upon the terminated app receiving background runtime when the live activity starts/ends remotely.
After some research, one potential reason is ActivityKit APIs are just not ready to return values via xpc connection at app startup, so moving these methods to applicationDidBecomeActive could resolve the problem. That's fine for ActivityAuthorizationInfo init, but for accessing activities, there is no other place in the lifecycle to see if an activity has been dismissed (especially in the scenario where app is terminated, so we get only 30 seconds ish of background runtime).
Curious if anyone has run into this or has any insights into ActivityKit API behavior.