Posts

Post not yet marked as solved
1 Replies
1.4k Views
Hi all, I have a sample app which I created in my local development env. I added the Family Controls capability and the simulator is logged-in to a child account on iCloud that is part of a family group. When I request authorization I keep getting Error Domain=FamilyControls.FamilyControlsError Code=3 "(null)" in the error object returned with the failure result. I am thinking Code 3 represents the enum case for FamilyControlsError which would be invalidArgument. What does that mean and how do I fix it? Also is there a way to map the error object into an FamilyControlsError rather than guess which enum case it is? Here is my code: import SwiftUI import FamilyControls @main struct TestScreentimeAPIApp: App {     @UIApplicationDelegateAdaptor private var appDelegate: AppDelegate     var body: some Scene {         WindowGroup {             ContentView()         }     } } class AppDelegate: NSObject, UIApplicationDelegate {     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { if #available(iOS 15.0, *) {             let center = AuthorizationCenter.shared             center.requestAuthorization { result in                 switch result {                 case .success():                     break                 case .failure(let error):                     print("error for screentime is \(error)")                 }             }         } }
Posted
by yahalawa.
Last updated
.