DeviceActivityMonitor Extension methods not being triggered

I did a lot of researches, but cannot understand why methods inside DeviceActivityMonitor extension are not calling.

What I've seen related to this question and already checked:

Do you starting monitoring for schedules?

  • Yes, I do by calling center.startMonitoring() as it has been explained on WWDC2021-10123.

I was searching an issue while creating the extension. Walk through steps that are described here.

  • Everything looks good for me.

Did you add Family Control Capability to extension's target?

  • Yes, I did.

Is your device authorized with FamilyControls?

  • Yes. The only doubt I have here that I'm authorising FamilyControls for .individual . But as I've asked previously, it shouldn’t be a reason.
Task {
      do {
        guard #available(iOS 16.0, *) else {
          // Fallback on earlier versions
          return
        }
         
        try await AuthorizationCenter.shared.requestAuthorization(for: .individual)
         
        switch AuthorizationCenter.shared.authorizationStatus {
        case .notDetermined:
          print("not determined")
        case .denied:
          print("denied")
        case .approved:
          print("approved")
        @unknown default:
          break
        }
         
      } catch {
        print("Error for Family Controls: (error)", error.localizedDescription)
      }
    }

--

So, what could I have missed?


Also, should I see bundles of app and extension in Xcode -> Debug -> Attach to Process -> ... or I have to add them to see logs in Console app?

Answered by Frameworks Engineer in 744011022

It sounds like you're doing everything right, so it's difficult to offer guidance without seeing your app and extension. Please file a bug report using Feedback Assistant and attach your Xcode project. Thanks in advance!

Hi, I write a similar app, the answer will be helpful for me too.

Thanks in advance!

Accepted Answer

It sounds like you're doing everything right, so it's difficult to offer guidance without seeing your app and extension. Please file a bug report using Feedback Assistant and attach your Xcode project. Thanks in advance!

Hi, I created a bug report and we are waiting for the answer for almost one month. It is just pending in Open status and that's it. Could we do anything else to get the answer? Any other options?

I will really appreciate the help with this question!

Any update on the topic? Also facing the same issue

After spending half of day on debbuging I finally managed to fix this. In my case problem was with iOS versioning in Device Activity Monitor Extension target. Take a look at YourDeviceActivityTarget -> Build Settings:

Selected lines should be deleted. If you selected it and remove it should work. I don't know if the problem is only because my phone has lower iOS version than 16.4 or that this option mismatch with version in the main project.

Hope, it works for you too! Let know, Marcin

As I tried later it still didn't work in real case scenario where I was trying to access data from main App. Using https://stackoverflow.com/a/33553524/10249964 lldb debbuging I was able to find that my extension hasn't App Group entitlment and because of that it was crashing.

Hi! Did you find a solution? I have the same problem.

DeviceActivityMonitor Extension methods not being triggered
 
 
Q