I receive this error when importing FamilyControls in my Expo Native module
[FamilyControls] Failed to get service proxy: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.FamilyControlsAgent" UserInfo={NSDebugDescription=connection to service named com.apple.FamilyControlsAgent}
How can I use FamilyControls from Apple in my React Native Expo Application ?
Currently i try to import it like this in my react native expo module.
import ExpoModulesCore
import FamilyControls
public class ExpoScreenTimeApiModule: Module {
public func definition() -> ModuleDefinition {
let center = AuthorizationCenter.shared
Name("ExpoScreenTimeApi")
AsyncFunction("requestScreenTimePermission") { () -> String in
let center = AuthorizationCenter.shared
do {
try await center.requestAuthorization(for: .individual)
return "Permission Granted"
} catch {
throw error // This will be caught as a Promise rejection in JavaScript.
}
}
}
}
I resolved the issue, by applying to the apple developer program. Furthermore I started the app via
selecting my physical device. Additionally I had to add Family Controls as capability in xCode.