Use a Custom Font in a Live Activity

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?

Can second this, I am having the same problem with a custom font and get the same error in Console as the activity silently fails to show in the simulator. Mine is 2.1MB. Removing the font from just one label makes it show properly so it must be to do with the size somehow although the font .ttf file is tiny which is very annoying. Have you found a solution yet?

Hi @iMoritz, I'm currently facing the same issue with using custom fonts inside Live Activities. Have you found a solution to this by any chance?

You need to make sure you have also added the fonts listed in the Widget extension's Info.plist file:

eg:

UIAppFonts Lato-Black.ttf Lato-Bold.ttf

And also make sure the Widget extension is listed as a target for the font files you are using.

Hope that helps!

@iMoritz and @arturstp this works fine for me. Remember to have the correct targets set for the font.

Text("Title")
   .font(.custom("YOUR-FONT-FILE", size: 18))
Use a Custom Font in a Live Activity
 
 
Q