Live Activity Start Token not generating after certain days of usage for non Production builds

Live Activity Start Token not generating after certain days of usage. We have implemented Live Activity feature where the initial activity is launched by our backend. But to start that first live activity I need push to start token which is generating for few days but all of sudden after certain days it stops generating. Currently we are in development phase so we test it on multiple devices and multiple time we are doing install and uninstall.

STEPS TO REPRODUCE

  1. Install the app
  2. Start token gets generated which is sent to our server
  3. After certain duration server sends the first live activity using that token
  4. user opens the app then we receive the updated token and send that token to server
  5. server uses that updated token to further update the live activity.

All this works fine. But after a week of usage we are observing that we stop getting start token from APNS. Not sure where exactly the thing is breaking. We have tried with different devices and different bundle identifiers but behaviour is same for all.

func generateStartToken() {
Task.detached { [weak self] in
guard let self else { return }
await self.observeActivityPushTokenAndState()
for await data in ActivityKit.Activity<LiveActivityAttribute>.pushToStartTokenUpdates {
let token = data.map { String(format: "%02x", $0) }.joined()
print("Activity Start token: ", token)
}
}
}
func observeActivityPushTokenAndState() {
Task.detached {
for await activity in ActivityKit.Activity<LiveActivityAttribute>.activityUpdates {
Task {
for await tokenData in activity.pushTokenUpdates {
let updatedToken = tokenData.map { String(format: "%02x", $0) }.joined()
print("Activity Update token: ", updatedToken)
}
}
Task {
for await content in activity.contentUpdates {
let updatedContent = content.state
print("Activity Updated: ", updatedContent)
}
}
}
}
}

The best first course of action here would be to use Console.app to monitor to the relevant processes related to your app and extensions.

A good way to start would be with filtering by the BundleID of the target and / or the target name itself (the process name).

Also be sure to check the system processes for additional information. This will vary based on what and where you are looking but some examples:
To debug APNS you'll want to monitor apd along with other relevant processes.
To debug WidgetKit, LiveActivities, Dynamic Island you'll want to monitor springboardd, liveactivitiesd along with other relevant processes.

Can you be more specific. These filters which you have mentioned above where already mentioned in docs and we have tried those. Have spent good amount of times watching console app and going through logs by adding mentioned filters. Still can't figure out the issue. The same app when we moved to TestFlight then that build is generating start token but if we generate any other flavour for our internal testing we don't see the start token in them.

Live Activity Start Token not generating after certain days of usage for non Production builds
 
 
Q