I know for start events, sending the timestamp isn't required. So that's easy.
However when I'm testing Live Activity using the Apple Push Notification Console. A lot of times I just need to copy/paste the payload and resend it again.
But then the timestamp field needs to get updated each time, because if it's from a time in the past, then it won't trigger.
This requires me to have to use an EPOCH converter to find the right time and then copy/paste it.
Is there a better solution to this? I know I can use curl, but that is not in the scope of my question.
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 am building a widget that supports 2 different widget kinds, each supporting systemSmall, systemMedium, and systemLarge size families.
My widget does download and display images so I expect memory usage to be on the higher end, but in debugging some memory issues, I notice that when I build my widget scheme to a physical device, things start off reasonable at ~12MB of memory usage. But as I change the widgets intent, add the other widget kind, or add different widget size families, this memory usage grows until it ultimately hits the 30MB cap.
My question is, is the 30MB memory limit spread across all my supported widget kinds/sizes? Or does each individual widget get its own 30MB cap?
i.e., if I have systemMedium Widget A and systemLarge Widget B, are they sharing that 30MB memory limit?
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
Extensions
Instruments
Debugging
WidgetKit
When I use the Activity.request method to start the Dynamic Island widget, there have been continuous crash reports online, Could you please provide some ideas on how to fix this crash? Thanks!
Crash backtraces:
0ActivityKitblock_copy_helper.101 (in ActivityKit)+21416
1CombinePublishers.FlatMap.Outer.receive(B.Output) (in Combine)+296
2Combineprotocol witness for Subscriber.receive(A.Input) in conformance Publishers.FlatMap<A, B>.Outer<A1> (in Combine)+20
3CombinePublishers.HandleEvents.Inner.receive(A.Output) (in Combine)+204
4Combineprotocol witness for Subscriber.receive(A.Input) in conformance Publishers.HandleEvents<A>.Inner<A1> (in Combine)+20
5CombineFilterProducer.receive(B) (in Combine)+2508
6Combineprotocol witness for Subscriber.receive(A.Input) in conformance FilterProducer<A, B, C, D, E> (in Combine)+20
7Combinepartial apply for closure #4 (C) in Publishers._Merged.request(Subscribers.Demand) (in Combine)+52
8CombinePublishers._Merged.guardedApplyDownstream<A>((C)) (in Combine)+180
9CombinePublishers._Merged.receive(A, Int) (in Combine)+400
10CombinePublishers._Merged.Side.receive(A) (in Combine)+20
11CombineJust.Inner.request(Subscribers.Demand) (in Combine)+692
12Combineprotocol witness for Subscription.request(Subscribers.Demand) in conformance Just<A>.Inner<A1> (in Combine)+20
13CombinePublishers._Merged.receive(subscription: Subscription, _: Int) (in Combine)+496
14CombinePublishers._Merged.Side.receive(subscription: Subscription) (in Combine)+20
15CombineJust.receive<A>(subscriber: A1) (in Combine)+420
16CombinePublishers.Merge.receive<A>(subscriber: A1) (in Combine)+380
17CombinePublisherBox.receive<A>(subscriber: A1) (in Combine)+104
18CombineAnyPublisher.receive<A>(subscriber: A1) (in Combine)+60
19CombinePublishers.RemoveDuplicates.receive<A>(subscriber: A1) (in Combine)+220
20CombinePublishers.HandleEvents.receive<A>(subscriber: A1) (in Combine)+300
21CombinePublisherBox.receive<A>(subscriber: A1) (in Combine)+104
22CombineAnyPublisher.receive<A>(subscriber: A1) (in Combine)+60
23CombinePublishers.FlatMap.receive<A>(subscriber: A1) (in Combine)+416
24CombinePublishers.RemoveDuplicates.receive<A>(subscriber: A1) (in Combine)+220
25CombinePublisherBox.receive<A>(subscriber: A1) (in Combine)+104
26CombineAnyPublisher.receive<A>(subscriber: A1) (in Combine)+60
27CombinePublishers.CompactMap.receive<A>(subscriber: A1) (in Combine)+440
28CombinePublisherBox.receive<A>(subscriber: A1) (in Combine)+104
29CombineAnyPublisher.receive<A>(subscriber: A1) (in Combine)+60
30CombinePublishers.SetFailureType.receive<A>(subscriber: A1) (in Combine)+420
31CombinePublishers.FlatMap.receive<A>(subscriber: A1) (in Combine)+416
32CombinePublishers.RemoveDuplicates.receive<A>(subscriber: A1) (in Combine)+220
33CombinePublisherBox.receive<A>(subscriber: A1) (in Combine)+104
34CombineAnyPublisher.receive<A>(subscriber: A1) (in Combine)+60
35CombinePublishers.CompactMap.receive<A>(subscriber: A1) (in Combine)+440
36CombinePublisherBox.receive<A>(subscriber: A1) (in Combine)+104
37CombineAnyPublisher.receive<A>(subscriber: A1) (in Combine)+60
38CombinePublishers.ReceiveOn.receive<A>(subscriber: A1) (in Combine)+660
39CombinePublisher.sink(receiveCompletion: (Subscribers.Completion<A.Failure>), receiveValue: (A.Output)) (in Combine)+316
40ActivityKitblock_copy_helper.101 (in ActivityKit)+33364
41ActivityKitblock_copy_helper.101 (in ActivityKit)+26716
42ActivityKitblock_copy_helper.101 (in ActivityKit)+53192
43ActivityKitblock_copy_helper.101 (in ActivityKit)+52408
44ActivityKitblock_destroy_helper.25 (in ActivityKit)+1140
45ActivityKitblock_destroy_helper.62 (in ActivityKit)+8220
46ActivityKitblock_destroy_helper.62 (in ActivityKit)+9364
47libswiftDispatch.dylibpartial apply for thunk for @callee_guaranteed () -> (@out A, @error @owned Error) (in libswiftDispatch.dylib)+24
48libswiftDispatch.dylibthunk for @callee_guaranteed () -> (@out A, @error @owned Error)partial apply (in libswiftDispatch.dylib)+12
49libswiftDispatch.dylibclosure #1 () in closure #1 (()) in OS_dispatch_queue._syncHelper<A>(fn: (()), execute: (), rescue: (Error)) (in libswiftDispatch.dylib)+188
50libswiftDispatch.dylibpartial apply for thunk for @callee_guaranteed () -> () (in libswiftDispatch.dylib)+24
51libswiftDispatch.dylibthunk for @escaping @callee_guaranteed () -> () (in libswiftDispatch.dylib)+24
52libdispatch.dylib__dispatch_client_callout (in libdispatch.dylib)+16
53libdispatch.dylib__dispatch_lane_barrier_sync_invoke_and_complete (in libdispatch.dylib)+52
54libswiftDispatch.dylibimplicit closure #2 (()) in implicit closure #1 (OS_dispatch_queue) in OS_dispatch_queue.asyncAndWait<A>(execute: ()) (in libswiftDispatch.dylib)+188
55libswiftDispatch.dylibpartial apply for implicit closure #2 (()) in implicit closure #1 (OS_dispatch_queue) in OS_dispatch_queue.sync<A>(execute: ()) (in libswiftDispatch.dylib)+72
56libswiftDispatch.dylibOS_dispatch_queue._syncHelper<A>(fn: (()), execute: (), rescue: (Error)) (in libswiftDispatch.dylib)+400
57libswiftDispatch.dylibOS_dispatch_queue.asyncAndWait<A>(execute: ()) (in libswiftDispatch.dylib)+136
58libswiftDispatch.dylibOS_dispatch_queue.sync<A>(execute: ()) (in libswiftDispatch.dylib)+60
59ActivityKitblock_destroy_helper.62 (in ActivityKit)+3272
60ActivityKitblock_destroy_helper.62 (in ActivityKit)+724
61ActivityKit___swift_store_extra_inhabitant_indexTm (in ActivityKit)+24928
62ActivityKit___swift_store_extra_inhabitant_indexTm (in ActivityKit)+23900
63 XXXApp static LiveActivityService.request()
......
I'm developing an app which will show the driver ETA and rendering the progress bar of the current ETA.
Intuitively the backend server sends the push notification every 3 seconds through firebase cloud message service to APNS so that the device can refresh the dynamic island smoothly.
But the live activity doesn't refresh as frequently as the backend service does.
It should refresh every 3 seconds but it turns out like refresh 30 ~ 60 seconds, sometimes it didn't refresh at all.
any body facing the same?
https://communities.apple.com/fr/thread/256121053
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
I am looking into the new CarPlay support for systemSmall widgets introduced in iOS 26 (Apple documentation).
I am trying to figure out if there is a way to programmatically detect whether the widget is currently being displayed on the iPhone/iPad home/lock screen or in CarPlay.
So far, I haven’t found any information in the documentation or APIs that indicate how to distinguish between these environments. Is there an API, environment value, or best practice for handling this scenario?
Thanks in advance for any insights!
Does the alert only serve the following purposes:
required for start events
require for any event that needs to alert the user (with sound or having the live activity show in expanded presentation)
while its content DO NOT matter. Only the presence of the field and its attributes matter.
The only time its content matter are when the receiving device is an Apple Watch.
Is that correct?
Hi there,
I'm using WCSession to communicate watchOS companion with its iOS app.
Every time watch app becomes "active", it needs to fetch data from iOS app, which works e.g. turning my hand back and forth.
But only when the app is opened after it was minimised by pressing digital crown, it didn't fetch data. My assumption is that scenePhase doesn't emit a change on reopen.
Here is the ContentView of watch app:
import SwiftUI
struct ContentView: View {
@EnvironmentObject private var iOSAppConnector: IOSAppConnector
@Environment(\.scenePhase) private var scenePhase
@State private var showOpenCategories = true
var body: some View {
NavigationStack {
VStack {
if iOSAppConnector.items.isEmpty {
WelcomeView()
} else {
ScrollView {
VStack(spacing: 10) {
ForEach(iOSAppConnector.items, id: \.self.name) { item in
ItemView(item: item)
}
}
}
.task {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
loadItems()
}
}
.onChange(of: scenePhase, initial: true) { newPhase, _ in
if newPhase == .active {
loadItems()
}
}
}
fileprivate func loadItems() -> Void {
if iOSAppConnector.items.isEmpty {
iOSAppConnector.loadItems()
}
}
}
What could be the issue?
Thanks.
Best regards
Sanjeev
Live Activity: no value in pushTokenUpdates and pushToStartTokenUpdates not called after app restart
When running application after installation I get a value in pushTokenUpdates and also the call to pushToStartTokenUpdates returns with the token value.
But, if I kill the app and restart it again, there is no value in pushTokenUpdates and the call to pushToStartTokenUpdates does not return.
Am I suppose to use the push to start token from the previous application run?
is there a different solution?
After opening 5 live activities using live activity push-to-start push notifications, I clear them from lock screen.
From this point forward I am unable to open new live activities.
Device log shows:
Could not create a new activity from push notification: ActivityKit.ActivityAuthorizationError.targetMaximumExceeded
How can I handle such use case?
shouldn't the count of opened live activities be reduced once the user clears the live activities? is this a bug?
Hello everyone,
I'm developing an app for iOS 18 using SwiftData, with iCloud synchronization enabled. My app also includes an interactive widget that allows users to mark tasks as complete, similar to Apple's Reminders widget.
I'm facing a specific issue with how iCloud sync is triggered when changes are made from the widget.
My Setup:
Xcode 16
Swift 6 / iOS 18
SwiftData with iCloud Sync enabled.
An interactive widget using App Intents to modify the SwiftData model.
What's working correctly:
App to Widget (Same Device): If I mark a task as complete in the main app, the widget on the same device updates instantly.
Widget to App (Same Device): If I mark a task as complete using the interactive widget, the main app on the same device reflects this change immediately.
App to App (Across Devices): If I make a change in the app on my iPhone, it syncs correctly via iCloud and appears in the app on my iPad.
The Problem:
The synchronization issue occurs specifically when an action is initiated from the widget and needs to be reflected on other devices, or when a change from another device needs to be reflected in the widget.
Widget Change Not Syncing to Other Devices: If I mark a task as complete in the widget on my iPhone, the change does not sync to my iPad. The task on the iPad only updates after I manually open the main app on the iPhone.
Remote Change Not Syncing to Widget: Similarly, if I mark a task as complete in the app on my iPad, the widget on my iPhone does not update to show this change. The widget only refreshes with the correct state after I open the main app on the iPhone.
It seems that the widget's AppIntent correctly modifies the local SwiftData store, but this action isn't triggering the necessary background process to push the changes to iCloud. The sync only seems to happen when the main app, with its active ModelContainer, is brought to the foreground.
My goal is for any change made in the widget to be reflected across all of the user's devices in near real-time, without requiring them to launch the main app to initiate the sync.
Is there a specific API I need to call from my AppIntent to force a SwiftData sync, or a project capability I might be missing to allow the widget extension to trigger iCloud pushes?
Any help or guidance would be greatly appreciated.
Thank you!
My start live activity CURL is not starting my live activity and I keep getting a decoding failure even though my curl matches my content state so my live activity is not starting. heres my CURL
--header "apns-topic: MuscleMemory.KimchiLabs.com.push-type.liveactivity" \
--header "apns-push-type: liveactivity" \
--header "apns-priority: 10" \
--header "authorization: bearer eyJhbGciOiJFUzI1NiIsImtpZCI6IjI4MjVTNjNEV0IifQ.eyJpc3MiOiJMOTZYUlBCSzQ2IiwiaWF0IjoxNzU3NDYwMzQ2fQ.5TGvDRk5ZYLsvncjKwXIZYN78X88v5lCwX4fRvfl1QXjwv8tOtO2uoId27LQahXA3zqjruu_2YoOfqEtrppKXQ" \
--data '{
"aps": {
"timestamp": '"$(date +%s)"',
"event": "start",
"content-state": {
"plain_text": "hello world",
"userContentPage": ["hello world"]
},
"alert": { "sound": "chime.aiff" }
},
"attributes-type": "KimchiKit.DynamicRepAttributes",
"attributes": {}
}' \
--http2 https://api.sandbox.push.apple.com/3/device/802fe7b4066e26b51ede7188a7077a9603507a0fa6ee8ffda946a864e75aa139602861538d6fb12100afbe9a3338d6c7c799d947dfacb2ee835f0339ecdc3165c9ed7e54839f5a3b89b76a011f5826cc
and here is my content state
public struct ContentState: Codable, Hashable {
public var plainText: String
public var userContentPage: [String]
public enum CodingKeys: String, CodingKey {
case plainText = "plain_text"
case userContentPage
}
public init(plainText: String, userContentPage: [String]) {
self.plainText = plainText
self.userContentPage = userContentPage
}
}
public init() {}
}
Durante o teste Uso do iOS 26 houve Build erro.
Foi ativado o recurso de Adiantamento de senha por seguranca. Bloqueio com tela azul e CRUZ AZUL e solicitando Recorvey.
O iPhone foi Resetado para IOS 18.6.2 pela Revendedora próxima
solicito apoio ao usuário
I'm having problems with my released app with iOS & WatchOS 26 support.
I've added AppIntentConfiguration support in the WatchOS app such that users can configure the complication. My complications also support multiple families and so I have slightly different configuration options available if its in the .accessoryRectangular slot or the .accessoryCircular one.
This works fine on Apple Watch when editing the Watch face. Here you can then select the configuration options fine and they are correct for the different variants.
However on iOS when configuring in the Apple Watch app on iPhone, the different complication size is ignored and the same configuration options are offered meaning they are wrong for one of them.
I created a sample project, here is the app intent code:
struct TestWidgetConfigurationIntent: AppIntent, WidgetConfigurationIntent {
static var title: LocalizedStringResource = "New Widgets with Configuration"
static var description = IntentDescription("Lots of stuff.")
static var isDiscoverable: Bool { return false}
init() {}
func perform() async throws -> some IntentResult {
return .result()
}
@Parameter(title: "Enable More Detail", default: true)
var moreDetail: Bool
@Parameter(title: "Enable Other Parameter", default: true)
var otherParameter: Bool
static var parameterSummary: some ParameterSummary {
When(widgetFamily: .equalTo, .accessoryRectangular) {
Summary("Test Info") {
\.$moreDetail
\.$otherParameter
}
} otherwise : {
Summary("Test Info") {
\.$moreDetail
}
}
}
}
In WatchOS you get the correct configuration options:
In iOS you do not, you get the same configuration option regardless of which family size you select:
This could be a bug so I've filed feedback FB20328319. Otherwise if anyone has insights, it would be very appreciated. This is all tested on the current iOS 26.0 and WatchOS 26.0 versions. Thanks!
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
WatchKit
watchOS
WidgetKit
App Intents
Often times myself and others have left flashlight on by accident. Burning it out for sometime of being in pocket or left on table the light stays on the whole time because of just not realizing it was on. The front of phone shows flashlight icon is white when light is on, but this is not good enough! The icon needs to be a bright red or some other color so user can see that the light is actually still on. This would help alot , ty
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
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.
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?
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
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?
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
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"
)
}
}
Topic:
App & System Services
SubTopic:
Widgets & Live Activities
Tags:
Siri and Voice
Intents
App Intents
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.