I want to display device activity reports for particular selected apps. for getting a daily basis app uses time. Now, what is happening? there are 10 apps selected from the family activity picker but some apps are displayed in the list. I need all 10 apps or more that I will choose from the family activity picker. The bellow code is used for fetching reports.
var body: some View {
VStack {
DeviceActivityReport(context, filter: filter)
}
}
bellow code is used for the filter
@State public var filter = DeviceActivityFilter()
init(selectedApps: Set<ApplicationToken>, selectedCategories: Set<ActivityCategoryToken>, selectedWebDomains: Set<WebDomainToken>) {
self.selectedApps = selectedApps
self.selectedCategories = selectedCategories
self.selectedWebDomains = selectedWebDomains
self.filter = DeviceActivityFilter(
segment: .daily(
during: Calendar.current.dateInterval(
of: .weekOfYear, for: .now
)!
),
users: .all,
devices: .init([.iPhone]),
applications: selectedApps,
categories: selectedCategories,
webDomains: selectedWebDomains
)
}
You can see we selected 3 apps from family activity picker but we getting 2 apps from DeviceActivityReport extension
following code is for device activity report extension
let context: DeviceActivityReport.Context = .totalActivity
// Define the custom configuration and the resulting view for this report.
let content: (ActivityReport) -> TotalActivityView
func makeConfiguration(representing data: DeviceActivityResults<DeviceActivityData>) async -> ActivityReport {
// Reformat the data into a configuration that can be used to create
// the report's view.
var res = ""
var list: [AppDeviceActivity] = []
let totalActivityDuration = await data.flatMap { $0.activitySegments }.reduce(0, {
$0 + $1.totalActivityDuration
})
for await d in data {
res += d.user.appleID!.debugDescription
res += d.lastUpdatedDate.description
for await a in d.activitySegments{
res += a.totalActivityDuration.formatted()
for await c in a.categories {
for await ap in c.applications {
if let apptoken = ap.application.token {
let appName = (ap.application.localizedDisplayName ?? "nil")
let bundle = (ap.application.bundleIdentifier ?? "nil")
let duration = ap.totalActivityDuration
let numberOfPickups = ap.numberOfPickups
let app = AppDeviceActivity(appToken: apptoken, id: bundle, displayName: appName, duration: duration, numberOfPickups: numberOfPickups)
list.append(app)
}
}
}
}
}
return ActivityReport(totalDuration: totalActivityDuration, apps: list)
}
Family Controls
RSS for tagPrevent access to the Screen Time API without guardian approval and provide opaque tokens that represent apps and websites.
Posts under Family Controls tag
184 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Can I use Screentime API in CLLocationPushServiceExtension?
For example, I am curious about whether it is possible to set a managed setting in the Screentime API to limit app usage time or change the time limit.
If the implementation of the above function is impossible or causes rejection by the App Store, is there a way to use the Screentime API in the background through push notification?
I implemented parents to manage their children's apps with FamilyActivityPicker.
Then, is there way to get child’s app list without FamilyActivityPicker?
When a request comes from the server, I want to set the screen time API of the requested phone or retrieve usage information. I would like to use silent push to complete that action in the background.
Is it impossible for the Screen Time API to run in the background?
Using the Screen Time API, I can create multiple ManagedSettingStore objects with different names. Is there a way to retrieve these later by name?
For example, if I create them dynamically from a configuration managed by the user of my app, and the app crashes or its data gets corrupted, how can I get rid of "stale" ManagedSettingStore objects that I no longer know?
Or, if I somehow lose the name of a ManagedSettingStore I created, how long does the store stay active? Forever? How can I get rid of the "stale" store?
I have recently noticed that ever since I downloaded iOS 18 Public Beta 1, I have been unable to get to the screen time settings, after clicking the tab, the app just freezes. Although after a while I did get to the Screen Time tab, but all of the previous changes to my screen time were voided. App limits, Downtime, you name it, all gone. While my app limits do not work, I noticed that downtime still functioned, but when my parent changed the downtime settings on their phone (running iOS 17 no betas), it did nothing on my end. I am currently submitting feedback to apple and am trying to find workarounds. On an unrelated note to this issue, I noticed that “One More Minute” and “Request More Time” aren‘t there anymore, does anybody have any ideas or workarounds on any of these?
This morning I downloaded iPad/iPhone OS 18 public beta and I went to send a request for youtube and I can’t. the only option that comes up when I press ask for more time is enter screen time passcode. TIA
"Hi everyone! We've encountered an issue with uploading our app to the App Store. We received the Family Controls Distribution permission, updated the certificates and profiles, submitted it for review, but received feedback that the request simply doesn't appear for the moderators. Does anyone know what the problem might be? Our request is: try await center.requestAuthorization(for: .individual). We also confirmed that the device must have TouchID or FaceID installed."
I am using Screen Time with "Block Limited Websites." For the most part it works, but...
Despite putting "Frame.io" and "api.apple-cloudkit.com" repeatedly in the "Approved" list, a message still appears showing that it is blocked. Please fix or show a resolution. Thank you!
I am working on a project that uses the FamilyActivityPicker from family controls. When I run it on the xcode simulator I can see the different categories of apps, but no specific apps. However, when I run the project on my phone I can see my apps. Is there a way to get this to work on simulator, as I would prefer to not have to download my project on my phone every time I want to test it. Many thanks!
I know it said that the device activity report extension data cannot be extract but what about importing data to the report ?
Certain entitlements require special permission from Apple like DriverKit or Screentime API/Family controls.
Those entitlements are tied to the bundle IDs of the app.
If those entitlements have been granted for an app from developer A (personal account) and we transfer that app to developer B (organization account), including the bundle IDs, will those bundle IDs keep the entitlement?
Or will we need to re-request from the developer account B?
Any insights or experiences regarding this process would be greatly appreciated.
What is the proper use case of blockedApplications in the Screen Time API? I seem to be using it exactly as the documentation describes, however it is being rejected from the App Store. I am passing in bundle identifiers to block/hide the applications from the device.
What would be the proper way to use blockedApplications? Or is there a way to use it at all in an app being submitted for review?
Thanks!
Hi, I'm having an issue where I'm trying to sort the applications related to the FamilyActivityPicker in the FamilyControls library. I'm able to populate a List in SwiftUI and able to see that a token is associated, but in general, there's no comparable to sort the Set which I converted into an array. Any help is appreciated!
⬇️ ANYONE ON APPLE'S SCREEN TIME TEAM, PLEASE READ THIS ⬇️
Let's summarize the situation.
3rd-party apps with screen time access can be disabled by going to Settings > Screen Time > Apps with Screen Time Access. That's fine.
Now, if I want to make it harder to remove my restrictions, I can ask a friend to enter a Screen Time Passcode for me. Great idea!
The problem is my Screen Time Passcode isn't requested when disabling permissions for a third-party app. It's required for modifying any other Screen Time setting EXCEPT permissions for 3rd party apps.
This is frustrating. The Screen Time passcode is a great feature. Making it compatible with permissions granted through the Family Controls framework is our NUMBER ONE REQUEST from tens of thousands of users.
This feature has been requested for a long time (iOS 16, iOS 17, …):
https://forums.developer.apple.com/forums/thread/714651
https://forums.developer.apple.com/forums/thread/727291
https://discussions.apple.com/thread/255421819
FB13548526
If you're a developer working on Screen Time, share your feedback below or file one using Feedback Assistant.
It is very disappointing to see it wasn't implemented for iOS 18. I can't believe this would require tremendous work from the Screen Time team to make it happen, but it would be a significant improvement for the Family Controls Framework and a ray of sunshine for all the developers who have worked really hard to deliver high-quality apps using the Screen Time API.
Could an Apple engineer or a Screen Time team member give us any updates? Implementing this before the public release of iOS 18 would make A LOT of developers happy.
Some of our users encounter an issue after updating their iPhone/iPad to iOS 17.5.1.
The tokens passed in the Shield Configuration extension don't match the tokens they selected in my app using the FamilyPicker before updating to iOS 17.5.1. It seems the tokens changed for no reason. My app can't match the token from the ShieldConfigurationDataSource to any tokens stored on my end, causing my shield screens to turn blank. The same applies to tokens in the Device Activity Report extension.
The only workaround I've found is to tell affected users to unselect and reselect apps and websites to block in my app. This gets them new tokens from the FamilyActivityPicker, which solves the issue. However, for some users, the bug reoccurs a few days later. Tokens seem to change again, causing the same issue in the Shield Configuration extension.
I am not able to reproduce the issue on my test devices so I have no sysdiagnose to attach. However, this issue is affecting other screen time apps:
https://developer.apple.com/forums/thread/732845
https://forums.developer.apple.com/forums/thread/756440
FB14082790
FB14111223
A change in iOS 17.5.1 must have triggered this behaviour. Could an Apple engineer give us any updates on this?
Since iOS 18 Seed 2, I've noticed an issue. When calling startMonitoring(_:during:events:) with an already monitored activity, intervalDidStart in the Device Activity Monitor extension isn't triggered as it should be.
I have to manually call stopMonitoring(_:) BEFORE restarting the activity for intervalDidStart to be called. This is 100% reproducible.
This is different from how it worked before iOS 18 Seed 2 and contradicts the official documentation, which says, “If the app already monitored the activity, this method overwrites the previous schedule and events.” IMO, this suggests we shouldn't have to stop the activity manually; the startMonitoring(_:during:events:) method should handle it automatically.
Is this a mistake or intended behavior?
If intended:
Could you give us the reason?
The documentation should be updated to reflect this change.
I've already filed a feedback about this issue (FB14110789).
Hello,
I am working on an app that schedules a device activity monitor from the screen time API.
I noticed that sometimes scheduling an activity monitor won’t work and instead I see this log:
Canceling request to […].DeviceActivityMonitorExtension because it exceeded its allowed time.
What does this mean? What exactly is exceeding its allowed time?
Would love to get some feedback on this so I can prevent this from happening.
Thanks a lot for any help and have a nice day!
Hi, I uses to have the Time management for my Kids. Since my kid is using the bêta version of ios 18, Time management is not working anymore. He can use the iPhone without any restrictions … what can I do?
The following is request authorization for familyControls:
AuthorizationCenter.shared.requestAuthorization { result in
// The request can either result in success or failure
switch result {
case .success():
break
case .failure(let error):
print("Error for Family Controls: (error.localizedDescription)")
}
}
But the output is"Error for Family Controls: Family Controls is only available for child and teen iCloud accounts."
I have added the "Family Controls" capability, How do I use "Family Controls"