I was able to start the device activity monitor. I was able to see the Device Activity Monitor Extension as a process, and was able to attach to it via Xcode.
Now I am trying block a specific 3rd party application, via the Shield.
I am using this piece of code for intervalDidStart :
override func intervalDidStart(for activity: DeviceActivityName) {
NSLog("Interval started for Device Activity")
let blockedApps : Set<Application> = [Application(bundleIdentifier: "com.facebook.Facebook")]
store.application.blockedApplications = blockedApps
super.intervalDidStart(for: activity)
}
I've declared store in the DeviceActivityMonitor class as follows :
let store = ManagedSettingsStore()
This is the error I see in the Console:
Error Domain=UsageTrackingErrorDomain Code=1 "Something without a application-identifier entitlement tried to manage usage budgets" UserInfo={NSLocalizedDescription=Something without a application-identifier entitlement tried to manage usage budgets}
The above use case should work right? I should be able to apply the settings inside DeviceActivityMonitorExtension?
What does the application-identifier entitlement look like? How do I use it?
Hi,
Any update on the above issue? I am also trying to block application in the same way but I am getting different error,
Attempts remaining: 1 Failed to fetch effective value for com.apple.ManagedSettings.effective-media-settings.changed: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.ManagedSettingsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.ManagedSettingsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction.}``` could you please guide me if I'm missing something?
If you are getting the above error, it could be because of Family control capability is not added in extensions.