Using FamilyActivityTitleView/FamilyActivityIconView Label sometimes freezes entire app

Hello,

we have been using the SwiftUI Label with the Family Controls tokens (ApplicationToken, ActivityCategoryToken - https://developer.apple.com/documentation/swiftui/label/init(_:)-39rkz)

And noticed that sometimes (quite rarely) the loading of the labels would take so long that it would freeze the entire app. Unfortunately as this only happened to our users (few times during user interviews) we aren't able to reproduce it on our devices and profile it.

My guess is that this "mapping" of tokens to images happens entirely on the UI thread because it is supposed to be fast but sometimes there is huge delay and everything freezes.

It would be great if the labels were somehow "prepared" on the background and the Label view would perhaps show some sort of loading and then get updated with the image of the app or category.

This freezing was happening even when our app showed at most six labels on the screen.

We tried some workarounds, namely to render the Label components in a backround and then use it as an image but instead of app icons we got yellow squares with red cross - probably due to privacy reasons.

Anyone run into this issue? Any solutions?

Post not yet marked as solved Up vote post of nemecek_f Down vote post of nemecek_f
990 views

Replies

I also encountered this problem and tried various methods, but it still has not been resolved.

I also encountered the same problem, does anyone have a solution?

I guess FamilyActivityTitleView/FamilyActivityIconView needs to access FamilyControlAgent to get data when drawing, and this drawing process is executed on the main thread.

When the number of Labels is too large, or the communication with the FamilyControlAgent process timeout, the main UI will be hang.

I've encountered the issue since I started working with the Screen Time API. We're receiving crash reports everyday that are caused by these app hangs.

I've filed a bug report about this (FB12332927), I invite you all to do the same so we can draw attention to this bug.

  • Same for us, we also reported it (FB11833456) . From our testing, it seems to be linked to scenarios where the call to get the screentime permissions hangs. We implemented a way to detect it, to avoid UI blocking. It's affecting around 7% of our daily active users.

  • @_lilpit how do you detect it right now?

Add a Comment

I have solved this problem

  • 1, please share your solution!
Add a Comment

@SoloX Can you share any details ? How did you solve it ? Thanks