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.

  • Issue with iOS 15.1.

    I implement the screen time API and restriction applications on the kid's device. However, I did not receive the shield once that time of some app had expired.. Also, I didn't see a kid device's apps restriction for selection by familyActivityPicker on the parent device.

    Also, I didn't see a kid device's apps restriction for selection by familyActivityPicker on the parent device. Please provide the necessary support.

  • It has been a seriously long time.. is there any solution to this?

Add a Comment

Replies

I'm facing all the issues you mentioned here. Also reported them through the Feedback Assistant.

I'm a bit surprised Apple decided to release this API which clearly is not yet ready for third-party developers.

Same here, I'm facing all the issues too. I was also starting to question my sanity

I am also facing the same error at the time of DeviceActivityCenter.startMonitoring

DeviceActivityCenter.startMonitoring always results in an MonitoringError.unauthorized error.

While filing a radar (feedback assistant post nowadays) I've came across the following console log from the system at the time of request to start monitoring.

rejecting read of { com.apple.CloudKit, mobile, kCFPreferencesAnyHost, /var/mobile/Library/Preferences/com.apple.CloudKit.plist, managed: 0 } from process 1083 (FamilyControlsAgent) because accessing these preferences requires user-preference-read or file-read-data sandbox access

Couldn't read values in CFPrefsPlistSource<0x143018430> (Domain: com.apple.CloudKit, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): accessing these preferences requires user-preference-read or file-read-data sandbox access

Maybe some capability they didn't document is missing here, hope the next beta version lands soon and fixes it.

I've summarized some questions for Apple's intentions in this forum post as well and attached some radars.

Go check it out and upvote please! https://developer.apple.com/forums/thread/685498

Same here, I've also tried all of this in the iOS 15 Beta 2 and 3 and Xcode 13 Beta 2 and 3 and I'm facing all these issues that you've maintained here. Waiting for a reply from Apple.

Apple has fixed some of these issues. Try again after erasing and installing (not updating) a device to the most recent beta. If you still experience problems please report them, with details and logs, via Feedback Assistant.

  • As per your instruction, I have update Xcode 13 beta-4 & iOS 15 beta. But Still we are facing the error.

    error : The operation couldn’t be completed. (DeviceActivity.DeviceActivityCenter.MonitoringError error 0.)

  • It worked for me - did you restore to beta 4 or update?

  • Yes, I have updated but still i am getting this error.

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.

The apps are now shown in the app running on the child device. They are not shown on the parent device.

After successfully authorizing a child device via AuthorizationCenter.shared.requestAuthorization, DeviceActivityCenter.startMonitoring always results in an MonitoringError.unauthorized error.

This appears to have been fixed.

Even though an app is authorized to managed ScreenTime on a child device, the child can always just delete the app.

This is fixed, parental sign-in is now required to delete the app.

The DeviceActivityMonitor extension is launched at the start of the interval, so that's good as well.

But there's still the critical issue where the parent app cannot list and set restricted apps installed on the child device. I'm still wondering whether the parent app is responsible for transferring restriction information via its own transport (pushes?) or is there a built in mechanism to push the app selection to the child app. If that's the case, the child could just disable pushes for the app and he won't receive restriction updates any more.

Another thing that's bugging me is that the FamilyActivityPicker is accessible on the child device without requiring authorization after it's been authorized once. As it stands now, the child could just update the selection and uncheck everything. I'll report this via Feedback Assistant.

  • @clawoo could you verify if any setting in the extension has an effect? I filed a report because in beta4 I now get a callback in the extension, but setting anything to blocked or shielded has no effect.

  • @clawoo for the family picker, your app needs to implement a mechnism to hide this from the child (either behind a passcode entry or completely) - I think Apple will not handle that for us.

  • Updating the ManagedSettingsStore.shield.applications when the schedule interval begins does not seem to have any effect on the shielded apps. Applying the selection from the main app directly from the selection callback seems to work.

I'm still not seeing the extension types/templates in Xcode 13 beta 4. Is the answer still to create the extensions manually?

Add a Comment

No the FamilyActivityPicker does not include "All Apps & Categories" anymore..

Feedback Report: FB9421632

i have created an extension and changed the identifier to com.apple.deviceactivity.monitor-extension i subclassed DeviceActivityMonitor in my class and designated it as the principal class of my app extension but non of the methods doesn't get called when trying to monitor an activity

  1. what method will trigger the extension? is it center.startMonitoring(activity, during: schedule) in that case why non of my extension DeviceActivityMonitor methods doesn't gets called?

  2. why calling requestAuthorization on parent device always fails?

  3. can anyone upload some sample code that actually do something?

Add a Comment

Hi,

I too faced the problem, one of my friend suggested to debug extension process and check console which helped. I received the call back to the code and while observing console logs expected events fired for start and end.

Raised this thread too - https://developer.apple.com/forums/thread/689460

Console logs under the process 'DeviceActivityMonitorExtension' below,

Interval started for daily

Interval ended for daily

Hope this will help.

  • What steps did you take in order to debug the extension process? And how did you see the logs under the process 'DeviceActivityMonitorExtension'?

  • Steps to debug extension via Xcode,

    1. Run the app on device via Xcode 2. Go to menu Debug -> Attach to Process -> Search for the extension name you have given for 'com.apple.deviceactivity.monitor-extension' and attach it Now you have two process attached for debug.

    Steps to collect logs from console,

    1. Launch Console and start monitor device traffic 2. Search for your extension name given for 'com.apple.deviceactivity.monitor-extension' under category 'Process'

Add a Comment

Update 13 Oct 2021 iOS 15.1 (19B5042h) and 15.1 beta 3 (19B5060d):

The Screen Time API still appears to be bugged out of its mind. I am not able to consistently list the applications from the child devices on the guardian device. It worked at one point for one child device with iOS 15.1 (19B5042h), meaning I was able to see the apps from the child device on the guardian device, but in my setup I had two child devices and I wasn't able to see and list the apps from the second one. I contacted Apple DTS and this is what they had to say:

Q: How would I go about seeing and managing apps from the second device? I also tried factory resetting the second child device and re-authorizing, but the apps never showed up on the parent device, even after cold starting the app. Is there a way to choose between the devices/accounts available to manage via FamilyControls?

A: There is no way to choose. All I can suggest is try de-authorizing both child devices and the guardian device, making sure all are enrolled in the same iCloud Family, and the child accounts are under 14 years old, and both have ScreenTime enabled. Make sure the guardian device can see the child devices in ScreenTIme. Then try again. If apps from both devices still don’t show up on the guardian device, then please file a bug report with sysdiagnose logs from all devices, so our engineers have the data they need to start investigating

I submitted the bug report FB9700146 with attached sysdiagnose logs from all the devices, but I'm not optimistic about this.

  • Filed the same bug report.

    Do they suggest that the users must have Screentime enabled before using such an app? So the developer would beed to know and ensure that they do this before(??, lol)

    But thanks for sharing the reply, it at least answers the question if the user will be able to choose between devices.

  • That is what they seem to suggest. The result was all the same regardless if ScreenTime was enabled by the guardian for the child devices in the Screen Time app or not.

  • Are they saying that the parent can't choose different apps for each child? You have to choose the same set of apps for all children in the iCloud Family?

I'm having the same issue with iOS 15.1.

I'm implementing the screen time API and restricting apps on the child's device. However, I did not receive the shield once the period of a certain app had expired.

Also, I didn't see a kid device's apps restriction for selection by familyActivityPicker on the parent device.

Please provide the assistance that is required.

  • I did the same for the screen time API and limit the applications on the device of the child. After the period of a certain app had expired, however, I did not receive the shield.

    I did not see any restriction on kid devices for selection by familyActivityPicker on the parent device. Please provide the assistance that is needed.

Add a Comment

Unable to show shield with IOS 15.1

I am waiting since then 3 months. Still, I didn't get any solution. I did code for the restrict app on the child's phone. But I never received a shield once a certain app period is expired.

Please help me if anyone has a solution.