Meet the Screen Time API

RSS for tag

Discuss the WWDC21 session Meet the Screen Time API.

Posts under wwdc21-10123 tag

73 Posts

Post

Replies

Boosts

Views

Activity

Unable to see the list of Applications in FamilyPicker for the parent device
I am able to see the list of Applications using the Family ActivityPicker on the child but not able to see it on the parent device. I can see the list of categories but there aren't any applications on each of the categories. My expectation is to see the applications which are installed on the child device. Please correct me if that is not the expected behavior. The family sharing is setup correctly, and on requesting authorization, it does fail to get the authorization as expected, because it's the parent account. I do see the correct behavior on the child device. I did provide authorization and I can see the list of applications inside the picker on Beta 2. On the parent device I see the following errors in the console : Connection error from Optional("com.apple.ManagedSettingsAgent"): Couldn’t communicate with a helper application.  Attempts remaining: 1 Failed to fetch effective value for com.apple.ManagedSettings.effective-media-settings.changed: Couldn’t communicate with a helper application. Failed to open usage store with error: The file “Store.plist” couldn’t be opened because there is no such file. Any ideas?
2
0
2.3k
Sep ’21
How does the Screen Time API handle multiple children and multiple devices?
Hi! There weren't any mentions in the video and documentation on how the Screen Time API handles multiple children and multiple devices. Specifically, cases like this: Multiple children with one device per child Multiple children with multiple devices per child (e.g. iPhone + iPad) Parent/guardian with multiple devices The FamilyActivityPicker doesn't take any parameters. What will happen when a parent with multiple kids opens the picker? Thanks.
2
0
1.3k
Sep ’21
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?
6
0
3.1k
Sep ’21
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)")                 }             }         } }
3
0
2.0k
Sep ’21
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.
16
0
6.3k
Aug ’21
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
8
0
3.4k
Aug ’21
Maximum number of blocked applications
After doing some testing I stumbled upon some errors when setting a fairly large amount of applications to store.applications.blockedApplications. I figured out that ManagedSettings are stored in a plist file which has a maximum size that the OS is willing to read (hint: it's less than 600KB) So I'd ask two questions: What's the maximum amount of applications we can set as blockedApplications and What does the console log of Ignoring forbidden setting application.blockedApplications: valueNotAllowed mean? Which value is not allowed?
1
0
1.5k
Aug ’21
Content Filter Providers with Family Control app
Hello! There was mentioned in the WWDC session that Also, on-device web content filters built with the Network Extensions framework can be included in your app and will be installed automatically and cannot be removed. But there is a notice in documentation for Content Filter Providers that You can use content filter providers in apps ... on iOS supervised devices only Can we rely on the fact that the documentation is not updated yet and com.apple.developer.family-controls entitlement with authorized app on child device would be enough for on-device web content filtering? We can't prove this with ourselves while the entitlement is only for Development where Content Filter Providers are allowed for default.
1
0
1.8k
Aug ’21
Where can I download the homework demo code
As Video said, here is a demo app called "homework" that would provided for developer to know how to use Screen Time API. However, I cannot find this demo code in the Apple Developer Sample Code website. Does anyone know where can I find it ? Thanks
Replies
1
Boosts
0
Views
938
Activity
Oct ’21
Get alarms time in clock app in my custom app
I want to get the alarms time set by user in the default alarm app in my custom app. Is there any way to do it, With the latest Screen time Api & Device Activity can we achieve this ??
Replies
0
Boosts
0
Views
536
Activity
Oct ’21
Is it possible to use familly activity picker with storyboard
I'm going to add Screen Time API functionality to the existing app. I'm wondering if I can use this functionality without SwiftUI
Replies
1
Boosts
0
Views
1.5k
Activity
Sep ’21
Designate principal class
Hello, I am wondering how to designate my DeviceActivityMonitor extension as the principal class on Xcode 13 beta 5 Documentation: https://developer.apple.com/documentation/deviceactivity/deviceactivitymonitor
Replies
1
Boosts
0
Views
3.3k
Activity
Sep ’21
Unable to see the list of Applications in FamilyPicker for the parent device
I am able to see the list of Applications using the Family ActivityPicker on the child but not able to see it on the parent device. I can see the list of categories but there aren't any applications on each of the categories. My expectation is to see the applications which are installed on the child device. Please correct me if that is not the expected behavior. The family sharing is setup correctly, and on requesting authorization, it does fail to get the authorization as expected, because it's the parent account. I do see the correct behavior on the child device. I did provide authorization and I can see the list of applications inside the picker on Beta 2. On the parent device I see the following errors in the console : Connection error from Optional("com.apple.ManagedSettingsAgent"): Couldn’t communicate with a helper application.  Attempts remaining: 1 Failed to fetch effective value for com.apple.ManagedSettings.effective-media-settings.changed: Couldn’t communicate with a helper application. Failed to open usage store with error: The file “Store.plist” couldn’t be opened because there is no such file. Any ideas?
Replies
2
Boosts
0
Views
2.3k
Activity
Sep ’21
Keyword Blocking on Screen Time API
Does the new Screen Time API allow keyword blocking as well? Not just individual URLs? Requested URLs in browsers and apps would be scanned and blacklisted keywords would stop the request from being processed. Is that possible with the new API?
Replies
0
Boosts
0
Views
662
Activity
Sep ’21
How does the Screen Time API handle multiple children and multiple devices?
Hi! There weren't any mentions in the video and documentation on how the Screen Time API handles multiple children and multiple devices. Specifically, cases like this: Multiple children with one device per child Multiple children with multiple devices per child (e.g. iPhone + iPad) Parent/guardian with multiple devices The FamilyActivityPicker doesn't take any parameters. What will happen when a parent with multiple kids opens the picker? Thanks.
Replies
2
Boosts
0
Views
1.3k
Activity
Sep ’21
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?
Replies
6
Boosts
0
Views
3.1k
Activity
Sep ’21
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)")                 }             }         } }
Replies
3
Boosts
0
Views
2.0k
Activity
Sep ’21
Screentime exemption
Is there a way to tell if Screentime is ON and the user has set a Downtime or App Limit and my app was NOT on the Always Allowed list? Is there a Screentime exemption for a medical app that must always be accessible for the safety of the user?
Replies
0
Boosts
0
Views
612
Activity
Aug ’21
NSExtensionPointIdentifier for ShieldActionHandler Extension
What is the NSExtensionPointIdentifier for this type of extension? Thanks.
Replies
1
Boosts
0
Views
1.1k
Activity
Aug ’21
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.
Replies
16
Boosts
0
Views
6.3k
Activity
Aug ’21
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?
Replies
3
Boosts
0
Views
3.2k
Activity
Aug ’21
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
Replies
8
Boosts
0
Views
3.4k
Activity
Aug ’21
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 ?
Replies
2
Boosts
0
Views
1.8k
Activity
Aug ’21
Can the Screen Time API be used to detect user login session time on macOS from login to logout?
I want to get the length of time users are logged into to their macOS account. Is this possible using the Screen Time API?
Replies
1
Boosts
0
Views
420
Activity
Aug ’21
Maximum number of blocked applications
After doing some testing I stumbled upon some errors when setting a fairly large amount of applications to store.applications.blockedApplications. I figured out that ManagedSettings are stored in a plist file which has a maximum size that the OS is willing to read (hint: it's less than 600KB) So I'd ask two questions: What's the maximum amount of applications we can set as blockedApplications and What does the console log of Ignoring forbidden setting application.blockedApplications: valueNotAllowed mean? Which value is not allowed?
Replies
1
Boosts
0
Views
1.5k
Activity
Aug ’21
Content Filter Providers with Family Control app
Hello! There was mentioned in the WWDC session that Also, on-device web content filters built with the Network Extensions framework can be included in your app and will be installed automatically and cannot be removed. But there is a notice in documentation for Content Filter Providers that You can use content filter providers in apps ... on iOS supervised devices only Can we rely on the fact that the documentation is not updated yet and com.apple.developer.family-controls entitlement with authorized app on child device would be enough for on-device web content filtering? We can't prove this with ourselves while the entitlement is only for Development where Content Filter Providers are allowed for default.
Replies
1
Boosts
0
Views
1.8k
Activity
Aug ’21
What so
What so
Replies
0
Boosts
0
Views
605
Activity
Aug ’21
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.
Replies
0
Boosts
0
Views
540
Activity
Jul ’21