App Shielding unexpectedly active outside of schedule

I'm using the Screen Time API to shield apps the user selects. The problem is, that the apps are always shielded, even outside of the schedule. Here is my function initiateMonitoring:

func initiateMonitoring(scheduleStart: DateComponents, scheduleEnd: DateComponents) {
    let schedule = DeviceActivitySchedule(
      intervalStart: scheduleStart,
      intervalEnd: scheduleEnd,
      repeats: true
    )

    let center = DeviceActivityCenter()
    do {
      try center.startMonitoring(.daily, during: schedule)
      logger.log("STARTED MONITORING")
    } catch {
      logger.log("FAILED MONITORING: \(error.localizedDescription)")
    }
  }

The expected result should be that the selected Apps should be blocked during the schedule the user specified, but not outside the schedule, but it is blocked 24/7. I've experimented with the DateComponents, but the issue may be somewhere else.

What's maybe interesting is, I tried Logging the DeviceActivityMonitor and somehow it doesn't get called. The logging-output from initiateMonitoring is printed in the console, but for the DeviceActivityMonitor it's not. I implemented it as recommended as a separate Extension Target. For more context, here is my DeviceActivityMonitor:

class DeviceActivityMonitorExtension: DeviceActivityMonitor {
  let store = ManagedSettingsStore()
  let logger = Logger()

  override func intervalDidStart(for activity: DeviceActivityName) {
    super.intervalDidStart(for: activity)
    logger.log("INTERVAL STARTED")
    let model = ShieldManager.shared
    let applications = model.selectionToDiscourage.applicationTokens
    let categories = model.selectionToDiscourage.categoryTokens
    let webCategories = model.selectionToDiscourage.webDomainTokens

    store.shield.applications = applications.isEmpty ? nil : applications
    store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.specific(categories, except: Set())
    store.shield.webDomains = webCategories.isEmpty ? nil : webCategories
  }
...

What's confusing me is that the apps are in fact shielded, so the MonitorExtension should be called, but neither the logging works nor my separate ShieldConfigurationExtension, maybe the issues are connected...

Any help would be gladly appreciated!

Well first of all, you should be also overriding intervalDidEnd, so that when the schedule ends, you can remove all shielding (setting everything to nil).

If you skip this, then the apps will never get unshielded.

App Shielding unexpectedly active outside of schedule
 
 
Q