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
Post
Replies
Boosts
Views
Activity
I finally figured it out. The apps being monitored were not changing with my model selection. I had to call center.startMonitoring() after performing the selection. Also, I couldn't print logs from the extension. However, I could perform other actions like showing a notification to verify it worked.
Same issue here. We submitted the permission request more than two weeks ago and now still waiting for their reply. No confirmation email was received after the submission. We can't even create an ad-hoc build for internal testing.