I'm trying to use a custom font in my Live Activitiy view. To do so, I copy the TTF file into the bundle in the Copy Bundle Resources build phase and add a corresponding entry in the UIAppFonts
dictionary in my widget extension's Info.plist. I specify a custom font for one of my Text views as follows: Font.custom("RobotoMono-Bold", size: 12)
, where the string is equal to the TTF file name. This approach works fine in SwiftUI previews and the custom font renders as expected, but when I try requesting an Activity from my app, the Live Activity never starts. The Activity.request(attributes:contentState:)
completes successfully but neither the Dynamic Island, nor the Lock Screen or Notification Center show the activity. Inspecting the simulator's logs in Console.app, I see a suspicious error:
Task [2] [my.app.bundle.WidgetExtension:Attributes type: MyActivityAttributes:35E934FB-D3BF-4929-B7A0-90E0886E1F1E] Reload failed; 1 retries remaining: com.apple.chrono.activites.content (1) ChronoKit.PlatterFetchingError(targetIdentifer: [my.app.bundle.WidgetExtension:Attributes type: MyActivityAttributes:35E934FB-D3BF-4929-B7A0-90E0886E1F1E], contentErrors: [ChronoKit.PlatterContentError(code: Returned timeline could not be accepted, targetIdentifer: [my.app.bundle.WidgetExtension:Attributes type: MyActivityAttributes:35E934FB-D3BF-4929-B7A0-90E0886E1F1E], contentIdentifer: [w:fix-373.00-h:dyn-64.00-160.00-cr:12.0], destinationURL: nil, underlyingError: Optional(ChronoKit.RequestCompletionOperation.Error.archiveTooLarge(fileSize: 2591912.0 B)))])
Note the archiveTooLarge(fileSize:) error type at the end that indicates some archive's size to be about 2.5 MB. I'm not sure which archive this error is referring to and how I can influence it. My WidgetExtension.appex bundle is 704 KB in size before adding the custom font and 857 KB afterwards. The TTF file itself is 109 KB in size.
Is using a custom font in a Live Activity this way supposed to work, am I just doing something wrong, or am I running into a limitation of the system here?