`eventDidReachThreshold` Not Triggering Consistently in Device Activity Monitor Extension

Hello everyone 👋

I wanted to discuss an issue that has always been somewhat present, but seems to have become more frequent since the latest iOS 17 versions.

When scheduling an activity that includes an event, the eventDidReachThreshold method does not trigger consistently within the device activity monitor extension.

The issue is intermittent. However, repeating the following procedure increases the likelihood of encountering the problem:

  1. Schedule a simple activity with an event: Set the start time to the beginning of the current day and the end time to the end of the current day. Include an application token and a threshold (that you've already met for today 🙂).
  2. Once the activity is scheduled, monitor whether eventDidReachThreshold triggers in the device activity monitor extension.

Workarounds I've discovered:

  • Restart the activity: Not very reliable.
  • Force restart the phone: A more drastic measure, but sometimes effective.
  • Just wait: Wait for an undetermined amount of time, ranging from a few minutes to several hours, after which eventDidReachThreshold will start triggering just fine again.

I've filed a bug report (FB13188666) concerning this specific issue. I'm curious to know if anyone else is experiencing it and what workarounds you've found!

Post not yet marked as solved Up vote post of thomas_maht Down vote post of thomas_maht
725 views

Replies

Hello, I have exactly the same problem. Any other solution?

The problem has recurred on my device, and I've managed to gather a sysdiagnose. By analyzing the logs, I think I've been able to track down one of the issues. This is the error I am seeing:

Failed to notify (null) that appLimitThreshold's threshold was reached: Error Domain=PlugInKit Code=4 "RBSLaunchRequest error trying to launch plugin com.jomo.Jomo.JomoDeviceActivityMonitor(8104FF60-5C49-45BD-8AFB-97BE88488134): Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x5dd8273e0 {Error Domain=NSPOSIXErrorDomain Code=111 "Unknown error: 111" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}" UserInfo={NSLocalizedDescription=RBSLaunchRequest error trying to launch plugin com.jomo.Jomo.JomoDeviceActivityMonitor(8104FF60-5C49-45BD-8AFB-97BE88488134): Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x5dd8273e0 {Error Domain=NSPOSIXErrorDomain Code=111 "Unknown error: 111" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}}

Basically, it seems the system is failing to launch the device activity monitor extension. As a result, the eventDidReachThreshold won't be triggered. This issue may persist for several minutes or hours once it begins.

By checking a previous error, it appears the system is failing to launch the extension because it's looking at an invalid path:

Service could not initialize: access(/private/var/containers/Bundle/Application/C6598B47-8977-447C-870B-4D21BDE8ACF9/Jomo.app/PlugIns/JomoDeviceActivityMonitor.appex/JomoDeviceActivityMonitor, X_OK) failed with errno 2 - No such file or directory, error 0x6f - Invalid or missing Program/ProgramArguments

I've filed a new bug report (FB13556935), which includes the sysdiagnose and precise timestamps of when the issue was reproduced. I think this bug is CRITICAL for all apps relying on the Device Activity framework. It likely explains a range of issues reported since the framework's release. Specifically, due to this bug, end users may encounter problems such as apps not unblocking at the end of a schedule, apps not blocking at the start of a schedule, and time limits not being updated, among others.

  • Did you get any response on this issue?

Add a Comment

I think I had the same issue for some time and then It went away. I crated a Scheme with only my Device Activity Monitor target and launched that way and the interval start would fire on time, the eventDidReachThreshold always seems to lag behind about 1-3 seconds longer than it should to fire for me :(.