Family Controls: `authorizationStatus` and `requestAuthorization` beyond dysfunctional

The functionality of authorizationStatus and requestAuthorization is completely broken. I'm using Xcode 15.3 and iOS 17.4.

Does anyone have a solution?

authorizationStatus doesn't behave as promised

  1. Revoking authorization in the system-wide settings does not change the authorizationStatus while the app is not closed. Calls to center.authorizationStatus will still return .approved instead of .denied.

  2. Even closing and relaunching the app after revoking authorization does not work: authorizationStatus is then .notDetermined when it should be .denied.

  3. Tapping "Don't Allow" in the alert shown after an initial call to requestAuthorization leaves the authorizationStatus unchanged, i.e. at .notDetermined. This is contrary to the promised outcome .denied (defined as: "The user, parent, or guardian denied the request for authorization") and contrary to the definition of .notDetermined (defined as: "The app hasn’t requested authorization", when it just did).

  4. Same issue when first tapping "Continue" followed by "Don't Allow" on the next screen.

As a consequence of authorizationStatus being broken, its publisher $authorizationStatus is worthless too.

requestAuthorization doesn't behave as promised

This is most likely a consequence of the corrupted authorizationStatus: when revoking authorization in the system-wide settings, a call to requestAuthorization opens the authorization dialogue instead of doing nothing. It is thus possible to repeatedly ask a user to authorize Family Controls.

Code sample

To reproduce, create a new SwiftUI app, add the "Family Controls" capability and a button executing the following task when tapped:

let center = AuthorizationCenter.shared
var status = center.authorizationStatus
print(status)
do {
    try await center.requestAuthorization(for: .individual)
    print("approved")
} catch {
    print("denied")
}
status = center.authorizationStatus
print(status)

The Screen Time API is so broken.

I have filed many feedback requests.

No replies.

No bug fixes.

I wonder if someone actually works on this.

Same issue here. Posted a thread about this and nothing from the apple developers/admin answers the questions. This forum should be renamed TRASH FORUM instead of DEVELOPER FORUM

Same here 👍

authorizationStatus is not updating on permission changed.

Alternate:

This is what I came up after spending hours in trying different solutions.

You can simply add below requestAuthorization in applicationWillEnterForeground (if you have logged in mechanism please call when user logged in), this will initiate permission popover if permission required otherwise it will not do anything.

Task {
      do {
          try await AuthorizationCenter.shared.requestAuthorization(for: .individual)
          } catch {
                print(error)
          }
      }

And to observe the permission status

AuthorizationCenter.shared.$authorizationStatus.sink { authorizationStatus in
            print("authorizationStatus updated")
}
.store(in: &cancellables)

Though this observer will get called on every app launch, you can update your views or block apps again depending on your needs.

We are seeing the same behavior. If I am in the app and then go to the Settings app to disable the app's Screen Time authorizations, and then return to the app and print(AuthorizationCenter.shared.authorizationStatus), it falsely prints "Approved". This is on iOS 18.3.1

Family Controls: `authorizationStatus` and `requestAuthorization` beyond dysfunctional
 
 
Q