Meet the Screen Time API

RSS for tag

Discuss the WWDC21 session Meet the Screen Time API.

View Session

Posts under wwdc21-10123 tag

37 results found
Sort by:
Post not yet marked as solved
454 Views

Is the Screen Time API completely broken in the betas?

I've been trying to get something to work with the Screen Time API, but almost everything related to it is completely and truly broken/unimplemented. I've tried all of this in the iOS 15 Beta 2 and 3 and Xcode 13 Beta 2 and 3. These are just a handful of the bugs I came across: Screen Time APIs do not work on the simulator. Calling AuthorizationCenter.shared.requestAuthorization on a simulator with a logged in child account always results in "FamilyControls.FamilyControlsError Code=3" FamilyActivityPicker does not list installed apps on either of the guardian's or child's devices, it only lists the categories. It's not clear at this point whether FamilyActivityPicker needs to be called on the parent or the child device. Assuming restrictions can actually be set, there is no API to allow setting up of restrictions for individual kids. After successfully authorizing a child device via AuthorizationCenter.shared.requestAuthorization, DeviceActivityCenter.startMonitoring always results in an MonitoringError.unauthorized error. AuthorizationCenter.requestAuthorization error in callback cannot be mapped back to FamilyControlsError because it is a plain NSError with an error code and FamilyControlsError does not expose an initialiser that takes a rawValue. Even though an app is authorized to managed ScreenTime on a child device, the child can always just delete the app. (I would try to submit a bug with device diagnostics about this using Feedback Assistant, but to top it all off at the moment I am receiving an error in FA that says "Unable to gather diagnostics" / "A problem was encountered when trying to gather diagnostics. Try gathering diagnostics again"). There's no device activity / shield configuration or shield action extension templates in Xcode. For those wondering, I created a CallDirectory extension and then changed the NSExtensionPointIdentifier in the plist to the appropriate value. What is the appropriate value? It's not mentioned in the documentation :), so I had to dig around in the Xcode support files to find out the following identifiers: com.apple.ManagedSettings.shield-action-service com.apple.ManagedSettingsUI.shield-configuration-service com.apple.deviceactivity.monitor-extension And this leads me to my last item: the documentation which is absolutely lacking. There is no programming guide for the frameworks and the Homework app we saw developed during WWDC is not available. It's not clear how the settings from the guardian app get applied to the child app. Is there a built-in mechanism or do we need to use our own implementation to transfer those changes (via push or whatever)? Of course I reported almost all of this via Feedback Assistant, but considering I had previous feedback for other APIs sit there untouched for years in the past, it's really frustrating and it feels like I'm just talking to myself with those bug reports. So, did I do something wrong and completely misinterpreted the capabilities and functionality of the ScreenTime API or is it truly broken and non-functional in iOS 15 Beta 2/3? There's absolutely no mention of these issues in the release notes so I am starting to question my sanity here.
Asked
by clawoo.
Last updated
.
Post not yet marked as solved
190 Views

Usage & Intention of the FamilyActivityPicker, DeviceActivityEvent and ShieldAction

Several questions to some intentions behind the frameworks and specific issues with it's usage, underlined with filed Feedback Assistant reports. (see below) Understanding of the Application class Such class can be either instantiated with the token (which only the OS provides with the FamilyActivityPicker) or through a bundleIdentifier. When is it intended to use the bundleIdentifier initializer? Currently it is not possible to set a threshold limit on an application created via bundleIdentifier because the DeviceActivityEvent only accepts a Set<ApplicationToken> which a developer can not instantiate. Family Picker Is it intended to use this picker only on the child's device or can the parent see which apps are installed on the child's device? (FB9375607 & FB9375638) If so, how do you imagine when a new app get's installed, does the guardian have to regularly check if a new app is installed and if so update it's settings on the child device? How can an app obtain the app icon of such an application or category? (FB9375449) ShieldConfiguration & Action When a schedule's callback happens (FB9375294) and an application is shielded we receive the localizedDisplayName of such application to show it in the shield UI. In the WWDC session it was said that you could have an action that let's you do a network request to e.g. ask the guardian to lift the restriction which is located in a different extension. Will the localizedDisplayName be available to be included in the request so that the guardian knows which app they lift the restriction on? Filed Feedback Assistant Tickets: Start monitoring returns Unauthorized when the device is authorized - FB9375294 Provide an app icon for an application instance - FB9375449 FamilyActivityPicker does not list apps on authorized child device - FB9375607 Show installed apps from child on guardians phone - FB9375638
Asked
by fuzi.
Last updated
.
Post not yet marked as solved
733 Views

Unable to load Family Activity Picker ScreenTimeAPI

I've created a test project in which I can successfully receive the FamilyControl authorization for the child device. Then on the parent device(where the parent account is logged in as the iCloud account), I basically used the following test code as provided in the documentation FamilyActivityPicker struct ExampleView: View {   @State var selection = FamilyActivitySelection()   @State var isPresented = false   var body: some View {     Button("Present FamilyActivityPicker") { isPresented = true }     .sheet(isPresented: $isPresented) {       FamilyActivityPicker(selection: $selection)     }     .onChange(of: selection) { newSelection in       let applications = selection.applications       let categories = selection.categories       let webDomains = selection.webDomains     }   } } I get the following error on the view : The operation couldn't be completed. (FamilyControls.ActivityPickerRemoteViewError error 1) For authorization errors I was able to look into the FamilyControlsError enum in the FamilyControls framework, but I can't find an enum for ActivityPickerRemoteViewError. Any idea as to why it's failing to load? I believe I am using the right setup in terms of the account that I am logged in to. I do have the FamilyControl capability, and I was able to successfully provide authorization for the child. Is there any other prerequisite that needs to be done to load the FamilyActivityPicker? Also, Do you know where I can find the error codes corresponding to ActivityPickerRemoteViewError ? What does error 1 indicate? I do see the following in the console logs : 2021-06-09 16:42:38.430112-0400 NN Family Control[849:38700] [lifecycle] [u 9F1F2B94-76F6-4D8F-ADE3-6D1C14EE5074:m (null)] [com.apple.FamilyControls.ActivityPickerExtension(1)] Connection to plugin interrupted while in use. 2021-06-09 16:42:38.476929-0400 NN Family Control[849:38704] [lifecycle] [u 9F1F2B94-76F6-4D8F-ADE3-6D1C14EE5074:m (null)] [com.apple.FamilyControls.ActivityPickerExtension(1)] Connection to plugin invalidated while in use.
Asked
by nmik2020.
Last updated
.
Post not yet marked as solved
242 Views

Creating device activity monitor extension

I am writing an app of family controls and device settings. In the docs for DeviceActivityMonitor I read about the principal class of device activity monitor extension, so I have to implement it. But, in XCode there is no such extension. How do i create it?
Asked Last updated
.
Post not yet marked as solved
37 Views

Requesting Authorization for Family Controls Returns Invalid Arugment

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)")                 }             }         } }
Asked
by yahalawa.
Last updated
.
Post not yet marked as solved
94 Views

Can we use the DeviceActivity framework without being parental control app?

We would like to use this framework to enable user to customize only relevant apps or websites that will be automatically connected via VPN. Could we use this framework for this use-case without being parental control app ?
Asked
by Gadireddi.
Last updated
.
Post not yet marked as solved
28 Views

Lock/Unlock Status

Could we detect the Lock/Unlock and Screen State Using Screen Time API. In the Screen Time API when we shield the discourage application. At that time you are using State object MyModal(). Where we can find that MyModal Class.
Asked Last updated
.
Post not yet marked as solved
291 Views

Sample code

Can you please make the sample code for the screen time api available?
Asked
by delray25.
Last updated
.
Post not yet marked as solved
53 Views

MonitoringError

I am facing this issue when i start monitoring error The operation couldn’t be completed. (DeviceActivity.DeviceActivityCenter.MonitoringError error 0.) source code in didFinishLaunchingWithOptions center.requestAuthorization{ result in     print(result)       switch result {       case .success():         print("success")                   switch self.center.authorizationStatus {         case .approved:           print("approved")                       let center = DeviceActivityCenter()           do {             try center.startMonitoring(.daily, during: self.schedule)           } catch {             print("error (error.localizedDescription)")           }            case .denied:           print("denied")         case .notDetermined:           print("not determined")         }       case .failure(let error):         print(error.localizedDescription)                 }     }
Asked Last updated
.
Post not yet marked as solved
67 Views

When will the ScreenTime API allow control of WiFi HotSpot connections??

Currently ScreenTime does not allow the ability to control if the Personal HotSpot can offer a wifi data connection. If a child's iPhone has ScreenTime DownTime enabled, when that ScreenTime starts the child can connect with another device (ex: TV, Oculus, Xbox, etc.) to the phones Personal HotSpot. The iPhones data connection, via Personal HotSpot, should be able to be controlled by ScreenTime.
Asked Last updated
.
Post not yet marked as solved
59 Views

Does Managed Setting enable parent app to also block out iOS native features?

Will the Managed Settings framework within ScreenTime API allow parents to manage use and/or block use of native iOS features such as phone use and text messaging along with web URLs and apps?
Asked
by bunzai2.
Last updated
.
Post not yet marked as solved
143 Views

DeviceActivityMonitor startMonitoring error

I created my Device Activity Monitor extension, and then attempted to start monitoring using the code example from the video: let schedule = DeviceActivitySchedule( intervalStart: DateComponents(hour: 0, minute: 0), intervalEnd: DateComponents(hour: 23, minute: 59), repeats: true ) let center = DeviceActivityCenter() do { try center.startMonitoring(.daily, during: schedule) } catch { print(error) } The startMonitoring call always fails for me with the same error: [monitor] Failed to create UsageTrackingAgent proxy: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.UsageTrackingAgent was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.UsageTrackingAgent was invalidated.} Setting up the extension is a very manual process, so I likely missed a step somewhere, but any ideas on what this error might be indicating?
Asked
by jda-blue.
Last updated
.
Post not yet marked as solved
398 Views

Family Controls application-identifier Entitlement error while blocking an application

I was able to start the device activity monitor. I was able to see the Device Activity Monitor Extension as a process, and was able to attach to it via Xcode. Now I am trying block a specific 3rd party application, via the Shield. I am using this piece of code for intervalDidStart :    override func intervalDidStart(for activity: DeviceActivityName) {     NSLog("Interval started for Device Activity")     let blockedApps : Set<Application> = [Application(bundleIdentifier: "com.facebook.Facebook")]     store.application.blockedApplications = blockedApps     super.intervalDidStart(for: activity) } I've declared store in the DeviceActivityMonitor class as follows :    let store = ManagedSettingsStore() This is the error I see in the Console: Error Domain=UsageTrackingErrorDomain Code=1 "Something without a application-identifier entitlement tried to manage usage budgets" UserInfo={NSLocalizedDescription=Something without a application-identifier entitlement tried to manage usage budgets} The above use case should work right? I should be able to apply the settings inside DeviceActivityMonitorExtension? What does the application-identifier entitlement look like? How do I use it?
Asked
by nmik2020.
Last updated
.
Post not yet marked as solved
425 Views

Screen Time for your self

Can I use Screen Time's Managed Settings to block access to certain apps on just my device, without the parent control part because the user creates a setup for themselves and for their own device?
Asked
by LH16.
Last updated
.