Post

Replies

Boosts

Views

Activity

Reply to Device Activity Extension not being called
Update with code. I have added the following code extension DeviceActivityName{   static let daily = Self("daily") } Run the following line after authorization `let schedule = DeviceActivitySchedule(     intervalStart: DateComponents(hour: 0, minute: 0),     intervalEnd: DateComponents(hour: 23, minute: 59),     repeats: true   )   let center = DeviceActivityCenter() do{       try center.startMonitoring(.daily, during: schedule)     } catch {       print("error: (error)") }` And In My Class overriding DeviceActivityMonitor: override func intervalDidStart(for activity: DeviceActivityName) {     super.intervalDidStart(for: activity)     let applicationTokens = model.selectionToDiscourage.applicationTokens     let categoryTokens = model.selectionToDiscourage.categoryTokens     model.store.shield.applications = applicationTokens.isEmpty ? nil : applicationTokens     model.store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categoryTokens)   } where model is my model class for storing the selections
May ’22