ActivityKit: sub-4KB JSON content-state exceeds size limit after numeric reserialization

I've filed FB24763792 about numeric JSON reserialization and the Live Activity content-state size limit.

A compact JSON content-state can be below 4,096 bytes but expand beyond that limit when Foundation parses and reserializes its numbers.

Here is an entirely synthetic Foundation reproduction:

import Foundation

let row = #"{"a":1.91,"b":1.91}"# let rows = Array(repeating: row, count: 100).joined(separator: ",") let input = Data("{"sequence":1,"readings":[(rows)]}".utf8) let object = try JSONSerialization.jsonObject(with: input) let output = try JSONSerialization.data(withJSONObject: object, options: []) print(input.count, output.count)

On macOS 26.6.2 and the iOS 26.5 simulator, this prints 2027 4827. Foundation writes 1.91 as 1.9099999999999999. Change both values to 1.95 and it prints 2027 2027.

In a separate local ActivityKit test, we passed the Foundation-reserialized data through a Decimal-based Codable state that preserved the expanded byte count:

  • The 1.95 control remained at 2,027 bytes and applied successfully.
  • The 1.91 case expanded to 4,827 bytes and was rejected with "Payload maximum size exceeded." The activity retained its previous state.

We also tested the exact boundary: a 4,096-byte encoded dynamic state applied, while 4,097 bytes was rejected. Static attributes did not count toward that tested local-update boundary.

This investigation began with remote Live Activities remaining stale while APNs returned HTTP 200 for dispatched updates. The device logged "Error extracing payload from incoming message" (spelling as logged).

We are confident numeric expansion is the mechanism behind our issue. The tests above reproduce expansion and rejection locally; they do not replay an exact captured failed remote push.

The ContentState documentation specifies a 4KB limit but doesn't make remote JSON normalization clear: https://developer.apple.com/documentation/activitykit/activityattributes/contentstate

Questions for Apple:

  • At what stage is remote content-state size measured?
  • Can internal reserialization preserve compact numeric representations, or can the limit use the supplied content-state bytes?
  • Can rejected incoming updates expose the underlying size error and measured byte count?

The synthetic reproducer and a simulator diagnostic collected immediately after the local rejection are attached to FB24763792.

ActivityKit: sub-4KB JSON content-state exceeds size limit after numeric reserialization
 
 
Q