How to get FamilyActivitySelection from DeviceActivityMonitorExtension in iOS Screen Time API

I have developed an application to lock selected apps using the Screen Time API (iOS). My app has been registered in Family Control and currently successfully executes app restrictions in both emulators and devices through TestFlight. I intend to incorporate a countdown timer feature to ensure that the app restriction function is activated when the timer stops.

However, the issue I'm facing is I can't get FamilyActivitySelection values from DeviceActivityMonitorExtension, and it causes the selected app always empty and I can't do restrictions.

I have attempted various ways, such as:

  1. Using singleton on MyModel
  2. Using the same App Groups for both App & Extension Target
  3. Using UserDefault to save & load FamilyActivitySelection values (already tested on App and it returns the correct value, but when I call it from DeviceActivityMonitorExtension and show it with local notification, the value is always empty)

Is there any solution to address this matter?

I put my code in here https://stackoverflow.com/questions/76935721/how-to-get-familyactivityselection-from-deviceactivitymonitorextension-in-ios-sc

How to get FamilyActivitySelection from DeviceActivityMonitorExtension in iOS Screen Time API
 
 
Q