Post not yet marked as solved
i'm struct dynamic island detail content
dynamicIsland: { context in
DynamicIsland {
expandedContent(context: context)
} compactLeading: {
....
} compactTrailing: {
...
}
i want show different content based on context.
private func expandedContent(context: ActivityViewContext<xxxx>)->DynamicIslandExpandedContent<some View> {
if (context.state.style == 0) {
return expandedControlContent1(context: context)
} else if (context.state.style == 1) {
return expandedControlContent2(context: context)
} else {
return expandedControlContent3(context: context)
}
}
compiles error
Function declares an opaque return type 'some View', but the return statements in its body do not have matching underlying types
Post not yet marked as solved
Is something wrong with testing live activities on Dynamic Island in iOS 17?
It works fine for devices without dynamic island.
It's a timer countdown. Initially, it didn't show up on the iPhone 15 Pro, but after installing and reinstalling the app it showed up. But now, the timer freezes like it was freezing while it was being tested on a simulator.
Is there something extra I should be doing for the Dynamic Island Display?
P/S: The app uses only Live Activities without the widget.
Post not yet marked as solved
Hello all,
I am trying to start Live Activity from remote push notification with the new ActivityKit api.
The documentation for starting live activity from a push notification says:
When the system receives the ActivityKit push notification on a device, it starts a new Live Activity, wakes up your app, and grants it background run time to allow you to download assets that the Live Activity needs.
While the system starts the new Live Activity and wakes up your app, you receive the push token you use for updates. To update and end the Live Activity, use this update push token as if you obtained it by starting a Live Activity from within your app.
Is there any information on how to get access to the background runtime and the push token, when the app is in background when the Live Activity is started? I can get the pushToStartTokenUpdates if the app is already running and push notification arrives (and starts the Live Activity), but not in the background, which makes getting updates not possible unless user launches the app.
Thanks!
Post not yet marked as solved
In iOS 17.2 we can start a live activity by push, and the document says:
When the system receives the ActivityKit push notification on a device, it starts a new Live Activity, wakes up your app, and grants it background run time to allow you to download assets that the Live Activity needs.
My problem is, in which callback can I be notified a live activity will be start by a push, so I can download some web contents such as images before the live activity be rendered.
Post not yet marked as solved
When setting a systemActounForegroundColor, no effect is seen on the lock screen when swiping away a Live Activity. Attempted with custom color assets and system colors, but maybe I am using it incorrectly?
@available(iOS 16.2, *)
struct DevicePollingLiveActivityWidget: Widget {
typealias constants = DevicePollingLiveActivityConstants
var body: some WidgetConfiguration {
ActivityConfiguration(for: AlarmPollingActivityAttributes.self) { context in
DevicePollingLockScreenView(deviceEvent: context.state.device)
.activityBackgroundTint(.clear)
.activitySystemActionForegroundColor(.white)
} dynamicIsland: { context in
DynamicIsland {
// Expanded UI goes here. Compose the expanded UI through
// various regions, like leading/trailing/center/bottom
DynamicIslandExpandedRegion(.leading) {```
Post not yet marked as solved
My background audio app stops updating its Live Activity after the iPhone locks, and doesn't resume updating the activity after tapping the screen or even after FaceID unlocks the device (without opening the lock screen).
My live activity requests a ContentState update & iOS updates the content for the activity as below:
Task{
log.debug("LiveActivityManager.updateLiveActivity() with new ContentState")
await liveActivity.update( ActivityContent(state:contentState, staleDate:nil) )
}
Below what my log looks like:
<<<<SWIPE LOCK SCREEN DOWN>>>>
DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState
iOS: Updating content for activity 0A519263-1E46-4BB6-BA4F-F3DDBC081AB4
DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState
iOS: Updating content for activity 0A519263-1E46-4BB6-BA4F-F3DDBC081AB4
<<<<PRESS LOCK BUTTON->Lock iPhone>>>>
INFO: --------protectedDataWillBecomeUnavailableNotification--------
DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState
iOS: Updating content for activity 0A519263-1E46-4BB6-BA4F-F3DDBC081AB4
DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState
DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState
DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState
<<<<LOOK AT & TAP LOCK SCREEN->Unlock iPhone without swiping up>>>>
INFO: --------protectedDataDidBecomeAvailableNotification-----------
DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState
DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState
DEBUG: LiveActivityManager.updateLiveActivity() with new ContentState
As shown in the log, normally iOS updates the content for my activity after my liveActivity.update request.
This works fine in the Dynamic Island and when after switching apps and swiping down to see the lock screen without locking the phone.
However, once I lock the phone, iOS stops updating the Live Activity content, and doesn't resume updates until after the app regains the foreground at least once.
Has anyone else encountered this behavior? Is this a setting that I'm missing, or a bug?
Post not yet marked as solved
In a live activity view, the update occurs upon pressing the button intent but does not automatically refresh after the application transitions to the background in SwiftUI.
I want to update my live activity every X minutes but it is not working while app in background mode and app going background mode to suspend mode after some time automatically
How can i update my live activity every X minutes using background Task.
Post not yet marked as solved
We are interested to know what is the rate limit on the push notifications for live activities. We understand there is a "budget" on the amount of push notifications on a users device. But is there some rate limitation we should be aware of on APNs?
Post not yet marked as solved
How can i pause and resume
Text((context.state.startTime.convertStringToDate() ?? Date()), style: .relative) and
ProgressView(
timerInterval: progressStartDate...Date().addingTimeInterval(TimeInterval((Int(earnTime) ?? 0) * 60)),
countsDown: false,
label: { EmptyView() },
currentValueLabel: { EmptyView() }
)
I couldn't find any document to pause and resume activity
Post not yet marked as solved
When is there going to be access to the ScreenTime API / ActivityKit API so that we can programmatically access Phone Pickups and Screen Time for applications?
Currently, the information is limited to getting callbacks when a threshold is hit or approached, but we don't know really anything about what the threshold is, and we cannot do that in the background.
It seems incredibly limited on scope.
Any thoughts or estimates on when this might be possible? Thank you so much!
Post not yet marked as solved
I'm using Text(targetDate, style:.relative) to show how a countdown of minutes until a given event. Unfortunately, this includes seconds, which takes unnecessary space and can get quite distracting when used on the dynamic island.
There are many examples of apps that show estimates like "7 minutes" or "7 min" but how do they get the countdown to update? Are background updates reliable enough for this? Surely they don't send a push notification every minute to update the remaining time? Or is there some formatting option that I'm missing?
Post not yet marked as solved
Environment:
iOS Version: 17.2
iOS Simulator Version: 17.2
Xcode Version: 15.2
Device: iPhone 15 Pro Max
App Target Version: iOS 17.2
Preconditions:
App with Live Activity feature is installed.
Device/Simulator is running iOS 17.2.
Steps to Reproduce:
Start the app and initiate a Live Activity with text styled as .timer.
Lock the device screen or switch to the lock screen view in the iOS Simulator.
Observe the Live Activity on the lock screen, noting the text style.
Unlock the device. This time noting the .timer changed its style.
The text style of the Live Activity remains consistent both on the lock screen and after unlocking the device, maintaining its .timer style throughout its lifecycle.
Frequency:
Occurs every time the steps are reproduced.
Post not yet marked as solved
LiveActivity is effective in ios16, but error reported only in ios14
Some error message reported from Xcode:
Process: LiveExtension [20099]
Path: my.app/PlugIns/LiveExtension.appex/LiveExtension
libswiftCore.dylib
swift_getAssociatedTypeWitness
SwiftUI
BodyAccessor.makeBody(container:inputs:fields:)
SwiftUl
closure #1 in WidgetGraph.init(rootBundle:)
Post not yet marked as solved
All the documentation I've found so far is made for SwiftUI (I understand it was primarily designed for use with SwiftUI), but I'm still not able to find if there is even a way to do it. I tried to implement this very simple tutorial (https://www.youtube.com/watch?v=oloHJn1kj3w) and since it is done with SwiftUI, I tried to make a hybrid using UIHostingController, but had no luck. I made sure the configuration was set correctly, and I think it is because when I enter the app's settings (from the iPhone's settings app) the live activities button is there and turned on.
Knowing how to do it would be awesome, but I would be satisfied with at least knowing if it is even possible, before wasting more time. Thanks.
Post not yet marked as solved
Can I have a play/pause button in a Live Activities notification for the user to play an audio file if he/she chooses to? Kind of like a Spotify-style/Apple-Music-style play/pause/skip/rewind functionality but in the long-lasting Live Activities notification. Thank you.
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.