Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

How to identify apps in FamilyActivitySelection?

Questions

I am developing a social screen time application that enables users to create “sprints” and set sprint goals—essentially time limits on usage for selected applications. For this functionality, users select the apps they wish to manage using the FamilyActivitySelection interface (from the FamilyControls framework).

However, our backend needs to distinguish each application uniquely (for example, via the app’s bundle identifier) in order to correctly map and enforce user-defined sprint goals. Unfortunately, we are encountering an issue where retrieving the bundle identifier directly from the FamilyActivitySelection is returning nil. As a result, we are unable to globally identify the selected apps.

Could you please advise if there is an alternative method or property available in the FamilyControls API that would allow us to uniquely identify the apps? Alternatively, is there another approach recommended by Apple for obtaining a global identifier for applications selected via FamilyActivitySelection?

Thank you for your time and assistance. I look forward to your guidance on how to resolve this issue.

Code

The following is the print statement I used to check if bundleIdentifier is nil after I stored user's selections to the variable selection using familyActivityPicker:

for app in selection!.applications {
    let bundleId = app.bundleIdentifier ?? "Unknown Bundle ID"
    let token = app.token
    let localizedDisplayName = app.localizedDisplayName ?? "Unknown Localized Display Name"

    print("Selected app bundle identifier: \(bundleId)")
    print("localizedDisplayName: \(localizedDisplayName)")
}

Console log result I received from the print statement above:

Selected app bundle identifier: Unknown Bundle ID
localizedDisplayName: Unknown Localized Display Name
Answered by _lilpit in 827372022

Hey ! This is by design, you cannot access app names or bundle identifier outside of the ActivityReport or shield extension sandbox for privacy reasons, you can only store and send opaque tokens in your app, not the actual apps.

Accepted Answer

Hey ! This is by design, you cannot access app names or bundle identifier outside of the ActivityReport or shield extension sandbox for privacy reasons, you can only store and send opaque tokens in your app, not the actual apps.

The system is behaving as designed in this case.

Hi, I understand that we get opaque tokens we can't rehydrate, but was wondering how other apps do this? Apps like Opal persist the app selection and show the app name and the icon of the selection later on in the app.

The tokens conform to Codable, so you can use standard Codable functionality to read and write an encrypted representation of the tokens. To show the text and/or icon for a token, you can pass it to a Label view in SwiftUI.

How to identify apps in FamilyActivitySelection?
 
 
Q