startMonitoring fails

When you try to start device activity monitoring like in the demo, it fails with an invalidSchedule error, even with the exact same schedule that was shown in the demo.

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(let error) {
    print("\(error)")
}

@jonathancurrie I got this to run by Stopping the monitoring first and then doing the startMonitor.

      center.stopMonitoring()
      try center.startMonitoring(.daily, during: schedule)
    }

@nmik2020 Do you have configured something else? When I do what you recommend I get an error

2021-06-26 00:02:58.961436-0400 TestParentalControlApp[1725:786313] [monitor] Failed to stop monitoring []: Error Domain=UsageTrackingErrorDomain Code=1 "Something without a application-identifier entitlement tried to manage usage budgets" UserInfo={NSLocalizedDescription=Something without a application-identifier entitlement tried to manage usage budgets}
startMonitoring fails
 
 
Q