denyAppRemoval not working | Managed Settings | Screen Time

I want to deny deleting of my app. In the doc says that we can use:

var denyAppRemoval: Bool? { get set }

But it's doesn’t work. Example of applying:

store.application.denyAppRemoval = true

What I'm doing wrong?

Should it work for .individual type of Family Control auth?

Replies

Definitely working for us with the individual permission ! did you try to repro your issue in a sample project ?

The following code should work to prevent app deletion provided that your app is properly authorized in FamilyControls:

let store = ManagedSettingsStore()
store.application.denyAppRemoval = true

Please ensure that the process using the ManagedSettings API is entitled with the FamilyControls capability and that the app is authorized via FamilyControls. If the problem persists, please file a report via Feedback Assistant and attach a sysdiagnose.

I want to deny deleting of my app.

Please note that application.denyAppRemoval isn't guaranteed to prevent your app from being deleted with .individual authorization, since .individual authorizations can be revoked at any time via Settings. If you'd like for your app to not be deletable on a child device, consider using a .child enrollment in FamilyControls. Please refer to the FamilyControls documentation for more information.