Post not yet marked as solved
I read in official documents that there is a height range of 84-160. But when I preview, it is always fixed at a certain height.
What should I do to make the height of DynamicIslandExpandedRegion grow dynamically according to the content?
Post not yet marked as solved
When i user a device without dynamicIsland, how can i show Live Activity on HomeScreen?
Post not yet marked as solved
Update live activity success via push notification, but start not, and i found notification status is "stored for device power considerations" in delivery log. Whether it's a real device or a simulator.
please help.
Post not yet marked as solved
Some users couldn't receive push notifications, and APNS returned a 'DeviceTokenNotForTopic' error. Upon validation using Apple's tool, I found that some tokens are identified as VoIP push tokens, and some as Live Activity (LA) push tokens.
When attempting to send a normal alert push using these VoIP/LA push tokens, it didn't work and returned a 'DeviceTokenNotForTopic' error.
These tokens were obtained from Apple's delegate function 'didRegisterForRemoteNotificationsWithDeviceToken.' It's unexpected to receive VoIP/LA push tokens from this event, but this issue is occurring, and I've observed it specifically in iOS 17 users.
This problem is not universal and is happening only for some users. Please take note that our app support VoIP Push, Live Activity Push and Normal Push notification.
Could this be an iOS 17 bug? Any advice on this matter would be appreciated.
Thanks.
Post not yet marked as solved
In iOS 17.2+, we have a new feature that lets you use a push notification to start a Live Activity. The docs mention this:
While the system starts the new Live Activity and wakes up your app, you receive the push token you use for updates.
How exactly does this work?
I don’t see any listeners/delegate methods that trigger when you receive a start event. Since I need to extract the push tokens from a specific instance, how do I get that instance?
I can call Activity<MyType>.activities to see all running Live Activities, but assuming my end user has multiple instances running, how do I locate the instance that was started remotely?
Post not yet marked as solved
I need to start an live activity from push APNs, the documentation says to use pushToStartTokenUpdates, but how I use or access this function?
Post not yet marked as solved
I've been trying to implement an animation for my live activity.
The animation is just rotating an image back and forth a bit and offsetting it up and down a bit. It'll give an airplane icon a subtle effect of "flying". Similar to the waveform animation in Apple Music, ie it's there for a it of visual flair.
The documentation here states that withAnimation is ignored so I'm not entirely sure how these "constantly animating" effects are achieved. It seems like animations can only occur as transitions between states but it seems like overkill for my use-case of just wanting to animate a tiny bit of UI.
Any advice would be greatly appreciated
Post not yet marked as solved
Hello!
Currently we are reviewing an issue whereby our users were obtaining Live Activities update, but somehow at the end, there were Live Activity updates that were not properly received by the device.
For example:
20 Live Activity updates sent to device, 17 were properly received, however the last 3 were not properly received (as can be seen by the UI of it not updating).
So far we have looked into a few root causes highlighted on the forums and on stackoverflow:
Timestamp of APNS (every one of the APNS has a different timestamp)
200 is seen from the APNS side, which is why we were confused by the push notification did not arrive on the device side
Looking into our logs, its unfortunately not covered enough to tell us when this had been received
Some questions here:
Is there a way we could log every Live Activity / Push Notification received from APNS? (for all scenario, app on lock screen, app in background)
Anyway to track a push notification's lifecycle? I know the Push Notification Console tool is useful for debug usage, but we wanted to see if there's something similar for production usage as well.
Post not yet marked as solved
Is there a way for a progressive web app to use the Live Activity feature?
Post not yet marked as solved
My live activity is working perfectly on iOS 16.4 simulator but when I run the same code on iOS 17 or 17.2, the live activity does not show up anymore. There are no errors thrown and it says that the live activity is active.
Post not yet marked as solved
We are using the below getPushToken() function to retrieve live activity token. However there are cases in production such that await activity.getPushToken() never finish. i.e. have logs of start event and no return or end event, the code path stuck at the guard statement.
Do anyone face same issue and if can advise what can go wrong and how best to handle such cases?
// log start event
guard let pushToken = await activity.getPushToken(),
!pushToken.isEmpty else {
// log return event
return
}
// log end event
extension Activity {
public func getPushToken() async -> String? {
for await data in pushTokenUpdates {
return data.map { String(format: "%02x", $0) }.joined()
}
return nil
}
}
Post not yet marked as solved
Hi,
I've been looking through the documentation for Live Activities and Activity Kit but I can't seem to get the answer to my question through the documentation. I have 2 questions:
Is it possible to have a button on the live activity that shows & hides a certain element on the live activity?
Is it possible to update the background color of the live activity?
Thanks in advance,
Sasri
Product Designer
Post not yet marked as solved
We are implementing new Live Activities in our app (we are a live shopping app). We also have PIP however i've noticed that when I start a live activity, then go into picture in picture, the dynamic island does not show the activity we've created for it. I can only see the activity on the lock screen widget while the audio for the videos plays. Is there any way to get the dynamic island to work with an app that is also in picture in picture? If there is and I'm doing something wrong, I can post some code. But from what I see, these don't seem to be compatible unfortunately :(
Post not yet marked as solved
struct NetworkImage: View {
let url: URL?
var body: some View {
Group {
if let url = url, let imageData = try? Data(contentsOf: url),
let uiImage = UIImage(data: imageData) {
Image(uiImage: uiImage)
.resizable()
}
else {
Image("league")
}
}
}
}
NetworkImage(url: URL(string: context.attributes.imageGame))
.aspectRatio(contentMode: .fill)
.frame(width: 35, height: 35)
.clipShape(Circle())
Post not yet marked as solved
Hi everyone,
I have two questions regarding some issues with the new iOS 17 interactive widgets and live activities.
Question 1: How can I update other Widgets and/or Live Activities, based on an AppIntent interaction in either one?
I have several widgets that is displaying the same information, but in different sizes (Small, Medium, Large and Lockscreen). Most of our users are using many of them together on their Lockscreen and Home Screen. When they are interacting with the AppIntent button in either the Widget og LiveActivity it does not update and vice-versa.
Based on the documentation it's pretty clear that interacting with a Widget it will update the timeline for that specific widget after the .perform() in the AppIntent is returned. Unfortunately, I also need to update the LiveActivity and the other TimeLines for the rest of the widgets. I have tried to use the WidgetCenter.shared.reloadAllTimelines() but it seems like it does not update the LiveActivity or the LockScreen widgets correctly.
Question 2: How can I update and reschedule the local notifications based on the interaction in the Widget and Live Activity?
The app sends a local notification whenever an activity starts or stops (e.g like a pomodoro timer with intervals). Let's assume the user have setup a 30 minute activity in the app, but now decides to pause the activity from either the widget or live activity. I then want to remove the scheduled local notification that was supposed to be fired in 30 minutes. I haven't been able to read from the documentation if this is possible, but would like to know if there is any way this can be performed.
Looking forward to hear if anyone have encountered the same challenges :)
Post not yet marked as solved
We are updating a Live Activity via push notifications quite frequently. As the documentation suggests, we are using NSSupportsLiveActivitiesFrequentUpdates for this case. We are sending all updates with apns-priority: 10.
Is it still possible that iOS throttles push-updates with this setting enabled?
For example we sent updates to APNS in this frequence:
2023-06-09T09:21:22.492224Z
2023-06-09T09:22:03.415876Z
2023-06-09T09:22:05.643268Z
2023-06-09T09:22:08.567353Z
2023-06-09T09:22:11.988442Z
2023-06-09T09:22:17.983494Z
2023-06-09T09:22:28.400757Z
2023-06-09T09:22:44.185622Z
2023-06-09T09:23:06.633058Z
2023-06-09T09:23:23.560052Z
2023-06-09T09:23:31.863625Z
2023-06-09T09:23:37.18351Z
2023-06-09T09:23:44.086319Z
2023-06-09T09:23:49.40655Z
2023-06-09T09:24:08.034848Z
2023-06-09T09:24:18.614194Z
2023-06-09T09:24:20.176428Z
2023-06-09T09:24:25.384654Z
2023-06-09T09:25:03.103147Z
2023-06-09T09:25:15.433726Z
2023-06-09T09:25:21.171693Z
2023-06-09T09:25:23.262028Z
2023-06-09T09:25:28.241116Z
2023-06-09T09:25:30.19816Z
2023-06-09T09:25:32.440543Z
2023-06-09T09:25:42.381815Z
2023-06-09T09:25:50.581656Z
2023-06-09T09:25:55.659846Z
2023-06-09T09:26:15.042667Z
2023-06-09T09:26:26.924626Z
2023-06-09T09:26:28.608762Z
2023-06-09T09:26:32.012874Z
2023-06-09T09:26:39.111211Z
2023-06-09T09:26:40.415326Z
2023-06-09T09:26:51.142985Z
2023-06-09T09:26:54.364073Z
2023-06-09T09:27:04.225692Z
2023-06-09T09:27:30.80347Z
2023-06-09T09:27:33.560981Z
2023-06-09T09:27:42.334313Z
2023-06-09T09:27:43.834646Z
All of those were sent successfully, but at some point the activity stopped updating. The activity continued for several hours after, but was never updated again.
What I checked so far:
From device logs we can see that there was no updated push-token
The sent content-state is correct
From these observations and considering the high-frequent updates, I suspect that there is still some throttling happening here.
Can anyone elaborate on this?
Thanks in advance.
Post not yet marked as solved
In this link, there is a description of live activity push token update:
"The push token for a Live Activity may change throughout its duration. When your app receives a new token, it receives foreground runtime to process the updated token. Keep track of the push token for each Live Activity. Additionally, invalidate an outdated token on your server when you receive an updated token to successfully send subsequent updates."
Our application did implement the solution to prepare for push token update. But so far, we don't see any occurrence of push token update from our backend records. The pushtokenupdates sequence only return the token once after live activity starts and does not emit more value afterward. Could you share a bit more on the condition for push token update? Under what circumstances will this happen? Thank you!
Post not yet marked as solved
How to monitor colorScheme to modify LiveActivity Style?
Post not yet marked as solved
When I try to initiate a Live Activity using the iOS 16.2 API for it, which includes the staleDate, when the staleDate has passed, rather than transitioning my Live Activity to its special ended state, the Live Activity presumably crashes because it looks disabled with a loading spinner on top
My ActivityAttributes struct is fairly simple, and the code that displays the "ended" state is itself not crashing, so unsure if I am doing something wrong
Here is the code for my ActivityAttributes:
struct TimerActivityAttributes: ActivityAttributes {
enum TimerType: Codable {
case rest, work
}
public struct ContentState: Codable & Hashable {
var isEnded: Bool
}
let endDate: Date
let exerciseName: String?
let timerType: TimerType
init(endDate: Date, exerciseName: String? = nil, timerType: TimerType = .rest) {
self.endDate = endDate
self.exerciseName = exerciseName
self.timerType = timerType
}
}
Here is the code that activates the Live Activity:
private func startLiveActivityNew(
attributes: TimerActivityAttributes,
contentState: TimerActivityAttributes.ContentState
) {
guard let endDate else { return }
let activityContent = ActivityContent(state: contentState, staleDate: endDate)
do {
ActivityManager.shared.activity = try Activity.request(
attributes: attributes,
content: activityContent
)
} catch (let error) {
print("Caught an error: \(error.localizedDescription)")
}
}
Here is the code I use to determine whether to display the ended state (to maintain compatibility with iOS 16.1):
private func isEnded(context: ActivityViewContext<TimerActivityAttributes>) -> Bool {
if #available(iOS 16.2, *) {
if context.state.isEnded || context.isStale {
return true
}
} else if context.state.isEnded {
return true
}
return false
}
And this is what happens after staleDate has passed.
I'm just not sure if I'm missing anything in my implementation
Post not yet marked as solved
Hey there,
I have noticed that my Live Activity's minimal presentation sometimes gets cut off when there is another app's Live Activity present. I tried adjusting the view in a number of ways, but it always seems to get cut off
I'm just curious if this is a known issue with iOS 17, or if there is a potential workaround. This issue did not occur on iOS 16, and I've even updated to iOS 17.1 and the issue is still present. The view code is identical
Here's the code that goes inside my minimal presentation
ProgressView(timerInterval: Date.now...context.attributes.endDate, countsDown: true) {
EmptyView()
} currentValueLabel: {
EmptyView()
}
.tint(.accent)
And here is what ends up happening. I've also seen this with some of Apple's own Live Activities, so I'm assuming this is an iOS bug?