I've been working on a small app using the new FamilyControls API, and I can't get the extension to make any visible changes to shields (or anything else).
-
I can get the main app to authorize and set and remove shields reliably.
-
I can also get the extension to run reliably in the background on a schedule (confirmed with Console).
But even if I try only setting the restricted apps to nil or the empty set the apps remain shielded until I run the same code from the main app.
-
I do have the Family Controls entitlement set on both the app and the extension, and I've tried having it off on the extension.
-
I have tried putting both of them into an App Group to no effect.
I've wrapped up the most basic working example I can think of into a project:
https://github.com/dpowers/ScreenPact
Any ideas about what stupid thing I'm missing?
."But even if I try only setting the restricted apps to nil or the empty set the apps remain shielded until I run the same code from the main app." - you need to remember that app and an app extension doesn't share data so it's likely that the store instance you are using isn't the same. what you need to do is to manage the selected apps list you want to shield or block using user defaults or core data or some other persistence storage that will be shared between your app and app extension. and block or unblock according to the data you are managing between them.
try to keep the blocking or unblocking on the app or on the app extension so only one of the will use the store. i chose to do this on the extension using the events that correspond with start and stop monitoring