ManagedSettingsStore is empty in DeviceActivityMonitor

I'm following the video with explanation of how to dealing with DeviceActivityMonitor extension.

I'm facing the issue with empty ManagedSettingsStore when I'm trying to retrieve discouraged apps. The apps successfully where blocked on the selection step via .familyActivityPicker.

The problem is that I can’t retrieve discouraged apps.

I read that Model.shared won’t work in extension. To sync an app and extension we need to use AppGroups. Do we need to use AppGroups if we follow code like in the video?

Hi, I have the same issue.

Thanks for the answer in advance!

The managed settings store contains what you put in it. If you’re shielding apps in the way demonstrated in the video, then at the end of the monitoring interval, you’ll set the shielded apps to nil in the store. If that was the only place your list of discouraged apps was persisted, then this means they’ll be discarded at the end of the interval. That’s probably not what you want.

In this case, you also need to keep the list of discouraged apps separately in your Model object, so that you can set them in the managed store at the start of each interval. Since your app and your extension don’t share the model data automatically, you’ll need a way of transferring the information between the two.

 The video doesn’t show this part of the data model management. One way is to use an app group, so that the same data is used by both the app and the extension when either creates its Model object.

@Polyphonic I'm confused why my store, initiated with a "name", does not persist and remember which tokens have been selected. I see apps like Opal replicate what I am lookin for but cannot figure out how to do so

ManagedSettingsStore is empty in DeviceActivityMonitor
 
 
Q