Hi,
I am implementing ScreenTime API and I have a very specific issue regarding the Family Activity Picker from FamilyControls on iOS.
The issue is regarding the callback from the Family Activity Picker when displayed from a Guardian/Parent device.
When Apps are selected from a parent/guardian iPhone in order to restrict them in the child's iPhone.
The onChange callback is giving an empty set of applications tokens. whereas when the same code runs on the child devices, set apps tokens are not empty but are useless as I need to have this in the parent device.
Here below, this below is the log printed from the code ( see below) when it is run on a parent device.
FamilyActivitySelection(includeEntireCategory: true, applicationTokens: Set([]), categoryTokens: Set([]), webDomainTokens: Set([])
Full code example:
@State private var isDiscouragedPresented = false
@State private var isEncouragedPresented = false
@EnvironmentObject var model: MyModel
var body: some View {
VStack {
Button("Select Apps to Discourage") {
isDiscouragedPresented = true
}
.familyActivityPicker(isPresented: $isDiscouragedPresented, selection: $model.selectionToDiscourage)
Button("Select Apps to Encourage") {
isEncouragedPresented = true
}
.familyActivityPicker(isPresented: $isEncouragedPresented, selection: $model.selectionToEncourage)
}
.onChange(of: model.selectionToDiscourage) { newSelection in
print(newSelection)
MyModel.shared.setShieldRestrictions()
}
}
}
Why this issue is happening on the parent/guardian devices?
A side note, as it might help some of you to answer my question.
The AuthorizationCenter authorization is returning an error when run on the parent device and AuthorizationStatus stays at “Not Determined”, whereas on the Child device authorization is getting the approved status.
My logic made me think that there is an Apple bug and maybe an Apps list callback from the Family Activity picker might be using the authorization status.
Does anyone has faced that particular issue, and might be able to solve it ?
I am happy to share more code if needed.
Both devices (Parent and Child) are using iOS 15.4. the issue was still there is iOS < 15.4.
Thanks !