I am trying to build a screentime app using the screentime api. I have basically copied the code from here: https://developer.apple.com/videos/play/wwdc2022/110336/ at timestamp 3:14. But when I run my code on an emulator I get the following error message:
Failed to enroll Aniyah with error: Error Domain=FamilyControls.FamilyControlsError Code=3 "(null)")
And I haven't been able to find much information on that specific error on the web. Here is my code for reference:
import SwiftUI
import FamilyControls
@main
struct WorklogApp: App {
let center = AuthorizationCenter.shared
var body: some Scene {
WindowGroup {
ContentView()
.onAppear {
Task {
do {
try await center.requestAuthorization(for: .individual)
} catch {
print("Failed to enroll Aniyah with error: \(error))")
}
}
}
}
}
}
I do not have an apple developer account and I have added Family Controls to my Signing & Capabilities. Any help with this issue would be much appreciated.