How to programmatically check if ApplicationToken or ActivityCategoryToken is expired in FamilyActivityPicker?
I'm building a Screen Time-based parental control app using FamilyControls
and ManagedSettings
. We use FamilyActivityPicker
to allow the user to select apps and categories to restrict, and we apply the shield using:
store.shield.applications = .specific(selection.applicationTokens) store.shield.applicationCategories = .specific(selection.categoryTokens)
Sometimes, we observe that the shield silently fails to apply — no error is thrown, but the restrictions aren't enforced. I suspect this may be due to expired or invalid tokens, possibly if the app was removed or the selection became stale.
My Questions:
- Can ApplicationToken or ActivityCategoryToken expire or become invalid over time?
- If yes, is there a supported or recommended way to detect whether a token is still valid before applying it to the shield?
- Is comparing the current shield values (store.shield.applications and store.shield.applicationCategories) after applying them a reliable validation method?
- What's the best practice to handle expired tokens (e.g. re-prompt the FamilyActivityPicker, or show a fallback)?
- What Is the Expiration Duration of Tokens from FamilyActivityPicker?
Any guidance or insight from the Screen Time/FamilyControls team would be greatly appreciated! Thank you!