What's new in Screen Time API

RSS for tag

Discuss the WWDC22 Session What's new in Screen Time API

Posts under wwdc2022-110336 tag

84 Posts

Post

Replies

Boosts

Views

Activity

How to run Timer into the ShieldActionExtension to wait user for 5 second to unlock the app?
// Make sure that your class name matches the NSExtensionPrincipalClass in your Info.plist. class ShieldActionExtension: ShieldActionDelegate {   override func handle(action: ShieldAction, for application: ApplicationToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {     // Handle the action as needed.     switch action {       case .primaryButtonPressed:         completionHandler(.defer)       case .secondaryButtonPressed:         Timer(timeInterval: 5, repeats: false) { timer in           Restrictions.shared.unlockedAllApps()         }                   completionHandler(.defer)       @unknown default:         fatalError()     }   }           override func handle(action: ShieldAction, for webDomain: WebDomainToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {     // Handle the action as needed.     print("func handle(action: ShieldAction, for webDomain: WebDomainToken,")     completionHandler(.close)   }       override func handle(action: ShieldAction, for category: ActivityCategoryToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {     // Handle the action as needed.     NSLog("handle(action: ShieldAction, for category: ActivityCategoryToken")     completionHandler(.defer)   } }
2
0
1.4k
Feb ’23
I would like to have some information about Screen Time API (Device Activity, Managed Settings, Family Control).
Hello, I've been trying to find answers to two specific issues related to the Screen Time API for several days now. I've gone through the Apple documentation and forums but have been unable to find concrete solutions. The only suggestion I received from Mr. Kmart, an Apple staff member, was to implement a Device Activity Report that follows the DeviceActivityReportExtension protocol. However, no examples or clear instructions were provided, making it quite difficult to put this into practice. **My Issues: ** How to restrict access to certain categories of apps for a child's device with a given time limit. How to retrieve the Screen Time data for the child's apps.  I would be grateful if you could provide some code functions to assist me.  PS: It would be helpful if Apple could also publish the source code of the applications.  Thank you.
0
1
908
Feb ’23
AuthorizationCenter.shared.requestAuthorization(for:.child)
I call the method "AuthorizationCenter.shared.requestAuthorization(for:.child) "in the device of ios16.3. it not displays the authentication sheet when my app first launches call this method. And the FamilyActivityPicker does not list installed apps on either of the guardian's or child's devices, it only lists the categories. But when i change the argument "child" to "individual" and call the method there displays the authentication sheet. Does anyone know why this is happening? Thanks for your answer.
1
0
745
Feb ’23
How Screen Time API works with family authentication failed with error = 2
I've been trying to get something to work with the Screen Time API, but almost everything related to it is unimplemented. I checked following links Device Activity https://developer.apple.com/documentation/DeviceActivity Managed Settings https://developer.apple.com/documentation/ManagedSettings Family Control https://developer.apple.com/documentation/FamilyControls Checked videos https://developer.apple.com/videos/play/wwdc2022/110336/ Problems I faced FamilyActivityPicker does not list installed apps on either of the guardian's or child's devices, it only lists the categories. There is no way to allow setting up of restrictions for individual kids, if we have many kids in family. If anyone gone through the same problem please upvote or if anyone has a solution please share Thanks
3
0
2.7k
Feb ’23
FamilySelectionPicker crashes due to internal memory limit
Disclaimer The setup of the FamilyControls capability, authorization etc. is all correct and properly working. The Issue Users complain that apps are not shown up on their parent device. Investigations For months we thought it's a syncing issue and eventually apps do show up. But another time (after already shown) they hide again. Insights We now found out, that the FamilyControlsAgent which is an internal process of iOS crashes due to exceeding their memory limit right before the picker should show up and then logs errors that it can't connect to "helper process". Feedback Tickets: Including multiple sys-diagnose files, step by steps and more: FB11983206 FB11863463 FB11983304 Attention As more and more users get frustrated with it, we hope some Apple engineer sees this and helps bring attention to a fast bug fix. Maybe just increase internal memory limit threshold for such process via entitlement. FYI We also think this is the reason why the DeviceActivityReport can't show apps and crashes due this limitation. But I would much rather prefer Apple to focus on the memory crash. FB11787794
0
2
609
Feb ’23
FamilyControlsAgent crashes due to internal memory limit
Disclaimer The setup of the FamilyControls capability, authorization etc. is all correct and properly working. The Issue Users complain that apps are not shown up on their parent device. Investigations For months we thought it's a syncing issue and eventually apps do show up. But another time (after already shown) they hide again. Insights We now found out, that the FamilyControlsAgent which is an internal process of iOS crashes due to exceeding their memory limit right before the picker should show up and then logs errors that it can't connect to "helper process". Feedback Tickets: Including multiple sys-diagnose files, step by steps and more: FB11983206 FB11863463 FB11983304 Attention As more and more users get frustrated with it, we hope some Apple engineer sees this and helps bring attention to a fast bug fix. Maybe just increase internal memory limit threshold for such process via entitlement. FYI We also think this is the reason why the DeviceActivityReport can't show apps and crashes due this limitation. But I would much rather prefer Apple to focus on the memory crash. FB11787794
0
3
1k
Feb ’23
FamilyControlsAuthenticationUI showing in an individual screentime
Dear Apple Team, First things first, our team can't be more appreciative for your hard work to improve screen time day by day so that we all can live a happier and more productive life. There's minor issue in screen time but that's misleading Apple users, where once they allow permission to restrict usage of their personal social media usage, they get to see the image below. This terrifies them on what does their family have to do with this or have access to their phone as a grown adult. Therefore, it'd be best if the FamilyControlsAuthenticationUI can be switched to a more personal/relatable if keyword (.individual) is being used, to not misled Apple users. Daniyal from BeTimeful.com - Making social media less addictive for the 🌎
3
1
1.7k
Feb ’23
iOS 16.1 NetworkExtensions are broken for parental control apps
Hello. It seems that NetworkExtensions (NEFilterDataProvider/NEFilterControlProvider) are completely broken on iOS 16.1 and iOS 16.2 for Screen Time API authorized apps. We have an active FB11748633 (iOS 16.1 System doesn't forward network flow to NEFilterDataProvider/NEFilterControlProvider of ScreenTime API authorized app) Everything worked perfectly on versions of iOS prior to 16.1 for an app publicly available on the App Store, but stopped working after updating to iOS 16.1. Steps to reproduce: Install parental control app with embedded Network Extensions of types: com.apple.networkextension.filter-data com.apple.networkextension.filter-control Authorize the app for ScreenTime API with FamilyControlsMember.child mode. Register Network Extensions in system by the NEFilterManager.shared instance, with filterBrowsers=true configuration. Start web browsing in Safari No one call of "handleNewFlow(_ flow: NEFilterFlow) -> NEFilterNewFlowVerdict" is triggered by the system And under debug we see: correctly initiated Network Extensions with our identifiers two corresponding processes registered in the OS correct calls of startFilter methods of both extensions Does anyone have any ideas or workarounds?
2
0
1.2k
Feb ’23
Device Activity App Icon Size
Hi, I am working on implementing new Screen Time API (from WWDC 22) in my app and I am trying to show app icons in the report by using Label(:ApplicationToken) initialiser and it works fine. However, all the app icons are very small unlike in the video from WWDC. If you take a look on the screenshot, I have app icons like on the right-most phone, but want smith like on the left-most. I tried to adjust the frame and font, but the only thing that works is scaleEffect, but, as you can imagine, the quality of the icon is terrible in this case. Apple's documentation is also not helping, so I was wondering how can I make this app icons bigger?
6
2
2.7k
Jan ’23
Authorizing Family Controls as individual fails in Simulator.
I'm attempting to authorize family controls as .individual in the latest Xcode 14 beta (14A5228q). do { try await AuthorizationCenter.shared.requestAuthorization(for: .individual) } catch { print(error.localizedDescription) dump(error) } Running this on the iPhone 13 Simulator (iOS 16), it throws the following error: The operation couldn’t be completed. (FamilyControls.FamilyControlsError error 3.) - Error Domain=FamilyControls.FamilyControlsError Code=3 "(null)" #0 - super: NSObject I have a dedicated App ID and have enabled the "Family Controls" capability. An Apple Systems Engineer suggested in this thread that "Requesting FamilyControls authorization on Simulator is supported by the ScreenTime API", although they don't say whether it actually works or not. The rest of the thread seems to suggest people are also having issues when running on a physical device so I'm reluctant to install the iOS 16 Beta as I use my phone daily for work projects. Is this FamilyControls authorization supposed to work in Simulator and are there any special considerations when authorizing as .individual?
4
5
2.5k
Jan ’23
Intercepting web traffic to detect malicious URLs and redirecting to a custom warning page
Hello, I am writing an iOS app which will filter web traffic for requests to malicious URLs according to our list. Instead of blocking them, the app will show a warning page, so users can choose to continue or stop. I intend this for the public, so I find the NE Content Filter not suitable for my app because it only works on supervised devices. I have tried with a Safari extension but prefer a system-wide solution. Would it be appropriate to build a custom VPN Packet Tunnel without an external VPN server for filtering the requests? Also, I heard of the Screen Time API, and is it possible to customise the block page? Thank you.
0
0
652
Dec ’22
ManagedSettings Framework not available on Mac, yet?
Is the following accurate regarding Screen Time API availability for macOS development? FamilyControls, including "Individual Authorization" introduced this year, IS available for macOS but only when building a macOS app from an existing iPad/iOS app? It says "Mac Catalyst 15.0+" for the FamilyControls framework. Or does creating a Multiplatform app targeting MacOS and iPadOS from scratch also count? https://developer.apple.com/documentation/FamilyControls ManagedSettings is only available for iOS and iPadOS 15.0+ and not available for Mac app development in any capacity? Particularly, I want to utilize the ability to push restrict and unrestrict requests for apps and web content / URLs via the Screen Time APIs on macOS. Is this possible with any existing frameworks on Mac? https://developer.apple.com/documentation/ManagedSettings Thank you in advance!
1
1
762
Dec ’22
DeviceActivity -> Screen time API. Accessing struct information
I need to get the time of phone pickup and time of usage after the pickup and drop. DeviceActivityData.ActivitySegment -> a struct contains all these information. Where and how can i access these information?    let v = DeviceActivityData.ActivitySegment().totalActivityDuration ERROR: 'DeviceActivityData.ActivitySegment' cannot be constructed because it has no accessible initializers How do I initialise DeviceActivityData?
2
0
2.9k
Dec ’22
Screen Time shield icon not changing with device appearance
So, I'm developing an application that uses the Screen Time API and ManagedSettings to shield applications. I have managed to configure the shield to the way I want it to look, but the icon (UIImage) I am using is not adapting to changes in the device's appearance. For example, if I set the managed settings and start monitoring the device while in the light appearance, the shield displays itself with the light appearance of the icon. However, when I change the device's appearance to dark, the icon remains in its light appearance, and vice versa. Restarting the monitoring of the device with DeviceActivities forces the icon to change, but that shouldn't be the way it works. Here is my shield configuration: ShieldConfiguration(     backgroundBlurStyle: UIBlurEffect.Style.systemThickMaterial,     backgroundColor: UIColor.orangeSoda,        icon: UIImage.appIconNoBG,          title: ShieldConfiguration.Label(         text: "Chores",         color: UIColor.orangeSoda),     subtitle: .init(         text: "Sorry, you can't use \(application.localizedDisplayName ?? "this app") because you haven't finished all of your chores.",         color: UIColor.label),     primaryButtonLabel: .init(         text: "Leave App",         color: UIColor.quiteWhite),     primaryButtonBackgroundColor: .orangeSoda ) Is there a known issue or workaround for this?
1
0
993
Nov ’22
My app gives error when requesting to use Family Controls individual authorization
2022-06-15 13:19:43.606183-0400 App Name Notification test[594:18404] [UIFocus] TtGC7SwiftUI14_UIHostingViewGVS_15ModifiedContentVS_7AnyViewVS_12RootModifier_ implements focusItemsInRect: - caching for linear focus movement is limited as long as this view is on screen. 2022-06-15 13:19:43.677534-0400 App Name Notification test[594:18436] [xpc] Connection error from Optional("com.apple.FamilyControlsAgent"): Couldn’t communicate with a helper application.  Attempts remaining: 1 Failed to enroll Luis with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.FamilyControlsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.FamilyControlsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction.}
3
0
6.1k
Nov ’22
Error when trying to request Authorization from AuthorizationCenter.
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.
1
0
830
Nov ’22
How to run Timer into the ShieldActionExtension to wait user for 5 second to unlock the app?
// Make sure that your class name matches the NSExtensionPrincipalClass in your Info.plist. class ShieldActionExtension: ShieldActionDelegate {   override func handle(action: ShieldAction, for application: ApplicationToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {     // Handle the action as needed.     switch action {       case .primaryButtonPressed:         completionHandler(.defer)       case .secondaryButtonPressed:         Timer(timeInterval: 5, repeats: false) { timer in           Restrictions.shared.unlockedAllApps()         }                   completionHandler(.defer)       @unknown default:         fatalError()     }   }           override func handle(action: ShieldAction, for webDomain: WebDomainToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {     // Handle the action as needed.     print("func handle(action: ShieldAction, for webDomain: WebDomainToken,")     completionHandler(.close)   }       override func handle(action: ShieldAction, for category: ActivityCategoryToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {     // Handle the action as needed.     NSLog("handle(action: ShieldAction, for category: ActivityCategoryToken")     completionHandler(.defer)   } }
Replies
2
Boosts
0
Views
1.4k
Activity
Feb ’23
I would like to have some information about Screen Time API (Device Activity, Managed Settings, Family Control).
Hello, I've been trying to find answers to two specific issues related to the Screen Time API for several days now. I've gone through the Apple documentation and forums but have been unable to find concrete solutions. The only suggestion I received from Mr. Kmart, an Apple staff member, was to implement a Device Activity Report that follows the DeviceActivityReportExtension protocol. However, no examples or clear instructions were provided, making it quite difficult to put this into practice. **My Issues: ** How to restrict access to certain categories of apps for a child's device with a given time limit. How to retrieve the Screen Time data for the child's apps.  I would be grateful if you could provide some code functions to assist me.  PS: It would be helpful if Apple could also publish the source code of the applications.  Thank you.
Replies
0
Boosts
1
Views
908
Activity
Feb ’23
AuthorizationCenter.shared.requestAuthorization(for:.child)
I call the method "AuthorizationCenter.shared.requestAuthorization(for:.child) "in the device of ios16.3. it not displays the authentication sheet when my app first launches call this method. And the FamilyActivityPicker does not list installed apps on either of the guardian's or child's devices, it only lists the categories. But when i change the argument "child" to "individual" and call the method there displays the authentication sheet. Does anyone know why this is happening? Thanks for your answer.
Replies
1
Boosts
0
Views
745
Activity
Feb ’23
How Screen Time API works with family authentication failed with error = 2
I've been trying to get something to work with the Screen Time API, but almost everything related to it is unimplemented. I checked following links Device Activity https://developer.apple.com/documentation/DeviceActivity Managed Settings https://developer.apple.com/documentation/ManagedSettings Family Control https://developer.apple.com/documentation/FamilyControls Checked videos https://developer.apple.com/videos/play/wwdc2022/110336/ Problems I faced FamilyActivityPicker does not list installed apps on either of the guardian's or child's devices, it only lists the categories. There is no way to allow setting up of restrictions for individual kids, if we have many kids in family. If anyone gone through the same problem please upvote or if anyone has a solution please share Thanks
Replies
3
Boosts
0
Views
2.7k
Activity
Feb ’23
FamilySelectionPicker crashes due to internal memory limit
Disclaimer The setup of the FamilyControls capability, authorization etc. is all correct and properly working. The Issue Users complain that apps are not shown up on their parent device. Investigations For months we thought it's a syncing issue and eventually apps do show up. But another time (after already shown) they hide again. Insights We now found out, that the FamilyControlsAgent which is an internal process of iOS crashes due to exceeding their memory limit right before the picker should show up and then logs errors that it can't connect to "helper process". Feedback Tickets: Including multiple sys-diagnose files, step by steps and more: FB11983206 FB11863463 FB11983304 Attention As more and more users get frustrated with it, we hope some Apple engineer sees this and helps bring attention to a fast bug fix. Maybe just increase internal memory limit threshold for such process via entitlement. FYI We also think this is the reason why the DeviceActivityReport can't show apps and crashes due this limitation. But I would much rather prefer Apple to focus on the memory crash. FB11787794
Replies
0
Boosts
2
Views
609
Activity
Feb ’23
FamilyControlsAgent crashes due to internal memory limit
Disclaimer The setup of the FamilyControls capability, authorization etc. is all correct and properly working. The Issue Users complain that apps are not shown up on their parent device. Investigations For months we thought it's a syncing issue and eventually apps do show up. But another time (after already shown) they hide again. Insights We now found out, that the FamilyControlsAgent which is an internal process of iOS crashes due to exceeding their memory limit right before the picker should show up and then logs errors that it can't connect to "helper process". Feedback Tickets: Including multiple sys-diagnose files, step by steps and more: FB11983206 FB11863463 FB11983304 Attention As more and more users get frustrated with it, we hope some Apple engineer sees this and helps bring attention to a fast bug fix. Maybe just increase internal memory limit threshold for such process via entitlement. FYI We also think this is the reason why the DeviceActivityReport can't show apps and crashes due this limitation. But I would much rather prefer Apple to focus on the memory crash. FB11787794
Replies
0
Boosts
3
Views
1k
Activity
Feb ’23
FamilyControlsAuthenticationUI showing in an individual screentime
Dear Apple Team, First things first, our team can't be more appreciative for your hard work to improve screen time day by day so that we all can live a happier and more productive life. There's minor issue in screen time but that's misleading Apple users, where once they allow permission to restrict usage of their personal social media usage, they get to see the image below. This terrifies them on what does their family have to do with this or have access to their phone as a grown adult. Therefore, it'd be best if the FamilyControlsAuthenticationUI can be switched to a more personal/relatable if keyword (.individual) is being used, to not misled Apple users. Daniyal from BeTimeful.com - Making social media less addictive for the 🌎
Replies
3
Boosts
1
Views
1.7k
Activity
Feb ’23
iOS 16 Content Filter not work with Screen Time APIs
In iOS 15 Content Filter can be used on non-supervised ios Devices if the device is authorized using the Family Control. Now In iOS 16, we have an individual authorization option will the Content Filter work on the iOS device that is authorized; using the individual authorization option?
Replies
2
Boosts
1
Views
1.9k
Activity
Feb ’23
iOS 16.1 NetworkExtensions are broken for parental control apps
Hello. It seems that NetworkExtensions (NEFilterDataProvider/NEFilterControlProvider) are completely broken on iOS 16.1 and iOS 16.2 for Screen Time API authorized apps. We have an active FB11748633 (iOS 16.1 System doesn't forward network flow to NEFilterDataProvider/NEFilterControlProvider of ScreenTime API authorized app) Everything worked perfectly on versions of iOS prior to 16.1 for an app publicly available on the App Store, but stopped working after updating to iOS 16.1. Steps to reproduce: Install parental control app with embedded Network Extensions of types: com.apple.networkextension.filter-data com.apple.networkextension.filter-control Authorize the app for ScreenTime API with FamilyControlsMember.child mode. Register Network Extensions in system by the NEFilterManager.shared instance, with filterBrowsers=true configuration. Start web browsing in Safari No one call of "handleNewFlow(_ flow: NEFilterFlow) -> NEFilterNewFlowVerdict" is triggered by the system And under debug we see: correctly initiated Network Extensions with our identifiers two corresponding processes registered in the OS correct calls of startFilter methods of both extensions Does anyone have any ideas or workarounds?
Replies
2
Boosts
0
Views
1.2k
Activity
Feb ’23
Device Activity App Icon Size
Hi, I am working on implementing new Screen Time API (from WWDC 22) in my app and I am trying to show app icons in the report by using Label(:ApplicationToken) initialiser and it works fine. However, all the app icons are very small unlike in the video from WWDC. If you take a look on the screenshot, I have app icons like on the right-most phone, but want smith like on the left-most. I tried to adjust the frame and font, but the only thing that works is scaleEffect, but, as you can imagine, the quality of the icon is terrible in this case. Apple's documentation is also not helping, so I was wondering how can I make this app icons bigger?
Replies
6
Boosts
2
Views
2.7k
Activity
Jan ’23
Get Screentime Data without charts
Hi everyone, I'm trying to fetch the Data for the users Screentime. I've seen an example on how to get it using PieCharts. Is it possible to simply get the data itself? I don't really need the charts anyway. Thanks in advance
Replies
1
Boosts
1
Views
1.4k
Activity
Jan ’23
Device Activity demo app
Good afternoon, in the video wwdc2022-110336 you mentioned your demo application where I can find its source code or examples? Thanks.
Replies
1
Boosts
1
Views
968
Activity
Jan ’23
Authorizing Family Controls as individual fails in Simulator.
I'm attempting to authorize family controls as .individual in the latest Xcode 14 beta (14A5228q). do { try await AuthorizationCenter.shared.requestAuthorization(for: .individual) } catch { print(error.localizedDescription) dump(error) } Running this on the iPhone 13 Simulator (iOS 16), it throws the following error: The operation couldn’t be completed. (FamilyControls.FamilyControlsError error 3.) - Error Domain=FamilyControls.FamilyControlsError Code=3 "(null)" #0 - super: NSObject I have a dedicated App ID and have enabled the "Family Controls" capability. An Apple Systems Engineer suggested in this thread that "Requesting FamilyControls authorization on Simulator is supported by the ScreenTime API", although they don't say whether it actually works or not. The rest of the thread seems to suggest people are also having issues when running on a physical device so I'm reluctant to install the iOS 16 Beta as I use my phone daily for work projects. Is this FamilyControls authorization supposed to work in Simulator and are there any special considerations when authorizing as .individual?
Replies
4
Boosts
5
Views
2.5k
Activity
Jan ’23
Screen time
How do you remove screen time with out password and without my parents to know
Replies
1
Boosts
0
Views
679
Activity
Dec ’22
Intercepting web traffic to detect malicious URLs and redirecting to a custom warning page
Hello, I am writing an iOS app which will filter web traffic for requests to malicious URLs according to our list. Instead of blocking them, the app will show a warning page, so users can choose to continue or stop. I intend this for the public, so I find the NE Content Filter not suitable for my app because it only works on supervised devices. I have tried with a Safari extension but prefer a system-wide solution. Would it be appropriate to build a custom VPN Packet Tunnel without an external VPN server for filtering the requests? Also, I heard of the Screen Time API, and is it possible to customise the block page? Thank you.
Replies
0
Boosts
0
Views
652
Activity
Dec ’22
ManagedSettings Framework not available on Mac, yet?
Is the following accurate regarding Screen Time API availability for macOS development? FamilyControls, including "Individual Authorization" introduced this year, IS available for macOS but only when building a macOS app from an existing iPad/iOS app? It says "Mac Catalyst 15.0+" for the FamilyControls framework. Or does creating a Multiplatform app targeting MacOS and iPadOS from scratch also count? https://developer.apple.com/documentation/FamilyControls ManagedSettings is only available for iOS and iPadOS 15.0+ and not available for Mac app development in any capacity? Particularly, I want to utilize the ability to push restrict and unrestrict requests for apps and web content / URLs via the Screen Time APIs on macOS. Is this possible with any existing frameworks on Mac? https://developer.apple.com/documentation/ManagedSettings Thank you in advance!
Replies
1
Boosts
1
Views
762
Activity
Dec ’22
DeviceActivity -> Screen time API. Accessing struct information
I need to get the time of phone pickup and time of usage after the pickup and drop. DeviceActivityData.ActivitySegment -> a struct contains all these information. Where and how can i access these information?    let v = DeviceActivityData.ActivitySegment().totalActivityDuration ERROR: 'DeviceActivityData.ActivitySegment' cannot be constructed because it has no accessible initializers How do I initialise DeviceActivityData?
Replies
2
Boosts
0
Views
2.9k
Activity
Dec ’22
Screen Time shield icon not changing with device appearance
So, I'm developing an application that uses the Screen Time API and ManagedSettings to shield applications. I have managed to configure the shield to the way I want it to look, but the icon (UIImage) I am using is not adapting to changes in the device's appearance. For example, if I set the managed settings and start monitoring the device while in the light appearance, the shield displays itself with the light appearance of the icon. However, when I change the device's appearance to dark, the icon remains in its light appearance, and vice versa. Restarting the monitoring of the device with DeviceActivities forces the icon to change, but that shouldn't be the way it works. Here is my shield configuration: ShieldConfiguration(     backgroundBlurStyle: UIBlurEffect.Style.systemThickMaterial,     backgroundColor: UIColor.orangeSoda,        icon: UIImage.appIconNoBG,          title: ShieldConfiguration.Label(         text: "Chores",         color: UIColor.orangeSoda),     subtitle: .init(         text: "Sorry, you can't use \(application.localizedDisplayName ?? "this app") because you haven't finished all of your chores.",         color: UIColor.label),     primaryButtonLabel: .init(         text: "Leave App",         color: UIColor.quiteWhite),     primaryButtonBackgroundColor: .orangeSoda ) Is there a known issue or workaround for this?
Replies
1
Boosts
0
Views
993
Activity
Nov ’22
My app gives error when requesting to use Family Controls individual authorization
2022-06-15 13:19:43.606183-0400 App Name Notification test[594:18404] [UIFocus] TtGC7SwiftUI14_UIHostingViewGVS_15ModifiedContentVS_7AnyViewVS_12RootModifier_ implements focusItemsInRect: - caching for linear focus movement is limited as long as this view is on screen. 2022-06-15 13:19:43.677534-0400 App Name Notification test[594:18436] [xpc] Connection error from Optional("com.apple.FamilyControlsAgent"): Couldn’t communicate with a helper application.  Attempts remaining: 1 Failed to enroll Luis with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.FamilyControlsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.FamilyControlsAgent was invalidated: failed at lookup with error 159 - Sandbox restriction.}
Replies
3
Boosts
0
Views
6.1k
Activity
Nov ’22
Error when trying to request Authorization from AuthorizationCenter.
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.
Replies
1
Boosts
0
Views
830
Activity
Nov ’22