Post

Replies

Boosts

Views

Activity

Block a category using ManagedSettings
I'm trying to block the entire "social" category using ManagedSettings. However, the function blockApps does not work because of a compiler error on the let socialCategory = AcitivityCategoryToken line ("(Argument type '(UnboundedRange_) -> ()' does not conform to expected type 'Decoder')" and "Missing argument label 'from:' in call"). The code is the exact same as the WWDC 2022 (this video) but it still does not work. import ManagedSettings extension ManagedSettingsStore.Name { static let social = Self("social") } public class ScreenTimeApiModule: Module { public func definition() -> ModuleDefinition { Name("ScreenTimeApi") Function("blockApps") { let socialCategory = ActivityCategoryToken(...) //ERROR "(Argument type '(UnboundedRange_) -> ()' does not conform to expected type 'Decoder')" and "Missing argument label 'from:' in call" let socialStore = ManagedSettingsStore(named: .social) socialStore.shield.applicationCategories = .specific([socialCategory]) print("Successfully blocked apps") } } }
1
0
529
Aug ’23