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

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.

How to identify apps in FamilyActivitySelection?
 
 
Q