I'm working with the FamilyControls and DeviceActivity frameworks in iOS (Swift).
In my app, I collect selected apps using a FamilyActivitySelection, and I access the selected apps via selection.applicationTokens, which gives me a Set<ApplicationToken>.
I would like to get either the bundle identifier or the display name of the selected apps from these ApplicationTokens.
I tried creating an Application instance using:
let app = Application(token: token)
print(app.bundleIdentifier)
print(app.localizedDisplayName)
However, both bundleIdentifier and localizedDisplayName are always nil.
My questions are:
Outside the extension (in the main app), how can I get the bundleIdentifier or display name from an ApplicationToken?
Is there an Apple-recommended way to resolve a Token<Application> into something human-readable or usable?
If not, what is the best practice to store or identify user-selected apps for later use?
Environment: iOS 17, Swift 5, Using FamilyControls and DeviceActivity APIs.
Thank you for any help!