I'm developing an iOS app that uses ScreenTime API.
Locally, everything works as expected - I have two physical devices in one Apple Family, and calling AuthorizationCenter.shared.requestAuthorization(for: .child) on a child device shows standard authorization dialog.
Currently the app is in a review by Apple, and they are saying they can't authorize as a child. From logs, and a screenshots provided by them, I see that on AuthorizationCenter.shared.requestAuthorization(for: .child)
call, FamilyControlsError.restricted
error is being thrown.
I didn't encounter this error once during development and can't simulate this issue now either. Tried everything - authorization on account that is not a child, not in a family, tried restricting everything possible for a child's device from ScreenTime settings. This specific error is never triggered.
Does anyone have idea why this error could happen? My last guess is the review team is using an enterprise account and that somehow intercepts with ScreenTime settings. But I don't have an enterprise account to test this theory.
Child authorizations in FamilyControls require devices not to be enrolled in mobile device management (MDM). Calling AuthorizationCenter.shared.requestAuthorization(for: .child)
while the device is enrolled in MDM will result in FamilyControlsError.restricted
. It is likely the app review team is using a device enrolled in MDM for testing, which is causing the enrollment to fail. If that is the case there should be a log that states:
"Family Controls permission requirement is not satisfied (device is managed by MDM)"
If this is not the case, please file a report with Feedback Assistant and attach a sysdiagnose so that we may investigate further.