How do I get Applications in categoryTokens

Accepted Reply

A FamilyActivityPicker will return application tokens if the user selects specific applications. There is no way to extract application tokens from a category token.

Add a Comment

Replies

A FamilyActivityPicker will return application tokens if the user selects specific applications. There is no way to extract application tokens from a category token.

Add a Comment

EDIT: My bad, i found this thread while looking on a way to list all categories / construct single category without displaying picker first. Looking at the API it seems this is not possible, but as per my original post, the video suggests that it should be possible.

@Kmart are you sure? WWDC's "what's new in screentime api" suggest that it might somehow be possible.

https://developer.apple.com/videos/play/wwdc2022/110336/ at 5:25 you can see the following code snipet:

import ManagedSettings

extension ManagedSettingsStore .Name {
    static let gaming = Self( "gaming" )
}

func worklogSetup() {
    let gamingCategory = ActivityCategoryToken(...)
    let gamingStore = ManagedSettingsStore(named: .gaming)
    gamingStore.shield.webDomainCategories = .specific([gamingCategory])
}

Have no idea how that ActivityCategoryToken is constructed, but I don't think the code suggests that the user had to select that category beforehand. Later in the video they create another ManagedSettingsStore the same way.