Screen Time API is completely UNRELIABLE!

I've been working with the Screen Time API for almost 6 months now. I found out it's completely unreliable, testing on iOS 17.4, the DeviceActivityReport is not showing, the DeviceActivityMonitor more often than not does not fire intervalDidStart. It's very frustrating.

Has anyone found out a workaround?

We all know there has to be something we're doing wrong, since apps like Opal and Jono does not present those types of issues.

Let's please unite our forces and find a solution. How to use this API should not be a secret!

Post not yet marked as solved Up vote post of Ivan018 Down vote post of Ivan018
149 views
  • Brace yourself for iOS 17.5 where the API becomes even more unreliable (even for apps that had been working great so far!)

  • How do you know?

  • To test if "intervalDidStart" is working, I started monitoring the apps, and call the shield app functionality in "intervalDidStart". My apps get shielded. Second, minimum schedule interval for monitoring the app is 15 mins. Anything less than that, won't trigger the monitor extension.

Replies

Hi @Ivan018 . To check if DeviceActivityMonitor delegates work, I created a singleton class, marked the target to both Project and DeviceActivityMonitor. This way I am able to access the selected apps from family activity picker in the monitor extension. I am shielding the apps in "intervalDidEnd". You can try the same in "intervalDidStart"

 override func intervalDidEnd(for activity: DeviceActivityName) {
    super.intervalDidEnd(for: activity)
    
    // Handle the end of the interval.
    /// Once interval ends restrict the app.
    let model = DataModel.shared

    let selection = model.getScheduledSelection()

    let applications = selection.applicationTokens
    store.shield.applications = applications.isEmpty ? nil : applications
}