Hi everyone,
I have a question regarding the intended privacy limits of the DeviceActivityReportExtension.
According to the documentation and the WWDC21 session "Meet the Screen Time API", this extension was created specifically to prevent the host application from accessing the user's underlying activity data (websites visited, app usage, screen time, etc).
But I have found that my host app is actually able to reconstruct this raw activity data from the activity report. I am able to extract specific visited websites and app usage durations back into the main app.
I reported this to Apple Security (Case ID: OE1100504480881 ), assuming it was a sandbox bypass. However, they closed the ticket stating that this is "expected behavior" and requires no fix.
My question for Screen Time Engineers: Is the documentation incorrect? If my host app is expected to be able to read this data, is there a formal API we should be using instead of extracting it from the report extension?
The current behavior contradicts the privacy limits described in the documentation, so I am confused if I should rely on this data access for my app features or if it will be patched later.
Thanks.
Device Activity
RSS for tagMonitor web and app usage through custom time windows and events.
Posts under Device Activity tag
72 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi there,
Starting with iOS 26.2 RC, all my DeviceActivityMonitor.eventDidReachThreshold get activated immediately as I pick up my iPhone for the first time, two nights in a row.
Feedback: FB21267341
There's always a chance something odd is happening to my device in particular (although I can't recall making any changes here and the debug logs point to the issue), but just getting this out there ASAP in case others are seeing this (or haven't tried!), and it's critical as this is the RC.
DeviceActivityMonitor.eventDidReachThreshold issues also mentioned here: https://developer.apple.com/forums/thread/793747; but I believe they are different and were potentially fixed in iOS 26.1, but it points to this part of the technology having issues and maybe someone from Apple has been tweaking it.
Topic:
App & System Services
SubTopic:
General
Tags:
Family Controls
Device Activity
Managed Settings
Screen Time
Hello!
I am experiencing some strange bugs around DeviceActivityEvents:
When creating a DeviceActivityEvent we can assign a threshold and applicationTokens.
The idea is, that after the user has spent said threshold on said apps, eventDidReachThreshold is called.
includesPastActivity is set to false.
On iOS 26 however, it happens (quite reliably after updating to a new beta seed) quite often that eventDidReachThreshold is called immediately (after a couple of seconds) instead of waiting for the threshold to be met.
Is anyone else seeing similar issues on iOS 26?
Only workaround I have found is to ask users to re-grant Screen Time permissions. This only holds for about two weeks though or at most until the next iOS 26 beta update is installed.
Feedback filed under:
FB18061981
FB18927456
Topic:
App & System Services
SubTopic:
General
Tags:
Family Controls
Device Activity
Managed Settings
Screen Time
I'm running into a contradictory requirement involving the DeviceActivity Report extension (com.apple.deviceactivityui.report-extension) that makes it impossible to both:
upload the app to App Store Connect, and
install the app on a physical device.
This creates a complete catch-22.
📌 Overview
My extension:
Path: Runner.app/PlugIns/LoADeviceActivityReport.appex
Extension point: com.apple.deviceactivityui.report-extension
Implementation (SwiftUI):
import SwiftUI
import DeviceActivity
@main
struct LoADeviceActivityReport: DeviceActivityReportExtension {
var body: some DeviceActivityReportScene {
// ...
}
}
This is the standard SwiftUI @main DeviceActivityReportExtension template.
🟥 Side A — iOS runtime behavior (device installer)
If I add either of these keys to the extension's Info.plist:
NSExtensionPrincipalClass
NSExtensionMainStoryboard
then the app cannot be installed on a real iPhone/iPad.
The device installer fails with:
Error 3002
AppexBundleContainsClassOrStoryboard
NSExtensionPrincipalClass and NSExtensionMainStoryboard are not allowed
for extension point com.apple.deviceactivityui.report-extension.
To make the app install and run, I must remove both keys completely.
This leaves the extension Info.plist like:
NSExtension
NSExtensionPointIdentifier
com.apple.deviceactivityui.report-extension
With this, the app installs and runs correctly.
🟥 Side B — App Store Connect upload validator
However, when I upload the IPA with the runtime-correct Info.plist, App Store Connect rejects it:
State: STATE_ERROR.VALIDATION_ERROR (HTTP 409)
Missing Info.plist values.
No values for NSExtensionMainStoryboard or NSExtensionPrincipalClass found in
extension Info.plist for Runner.app/PlugIns/LoADeviceActivityReport.appex.
So ASC requires that at least one of those keys be present.
💥 The catch-22
If I add PrincipalClass / MainStoryboard:
✔ App Store Connect validation passes
❌ But the app can NOT be installed on any device (Error 3002)
If I remove PrincipalClass / MainStoryboard:
✔ The app installs and runs correctly
❌ ASC rejects the upload with “Missing Info.plist values”
There is currently NO Info.plist configuration that satisfies both:
Runtime:
"NSExtensionPrincipalClass and NSExtensionMainStoryboard are not allowed."
App Store Connect:
"You must include NSExtensionPrincipalClass or NSExtensionMainStoryboard."
📌 Expected behavior
For SwiftUI @main DeviceActivityReportExtension, the documentation and examples suggest the correct configuration is:
NSExtensionPointIdentifier
com.apple.deviceactivityui.report-extension
with no principal class or storyboard at all.
If that is correct for runtime, ASC seems to need updated validation rules for this extension type.
❓My Questions
What is the officially correct Info.plist configuration for a SwiftUI DeviceActivityReportExtension?
Should principal class / storyboard not be required for this extension type?
Is this a known issue with App Store Connect validation?
Is there currently a workaround that allows:
installation on device and
successful App Store Connect upload,
without violating runtime restrictions?
Hello,
I'm currently experiencing an issue with the DeviceActivityMonitor extension in my code, specifically with the eventDidReachThreshold callback. I'm hoping to get some insights into why this problem occurs and how to resolve it.
Problem:
Issue 1: The eventDidReachThreshold callback is not triggering as expected. It appears that the callback is not being invoked when the threshold is reached.
Issue 2: After a few seconds, the eventDidReachThreshold callback starts to trigger multiple times. This unexpected behavior is causing problems in my code, as it results in incorrect actions being taken.
iOS version: iOS16.7.2 and iOS17.1
Xcode version: 15.0.1
Swift version: 5.9
Here is my code to start the monitoring:
func startMonitoring() {
var startTime : DateComponents = DateComponents(hour: 0, minute: 0)
let endTime : DateComponents = DateComponents(hour: 23, minute: 59)
/// Creates the schedule for the activity, specifying the start and end times, and setting it to repeat.
let schedule = DeviceActivitySchedule(intervalStart: startTime, intervalEnd: endTime, repeats: true, warningTime: nil)
/// Defines the event that should trigger the encouragement.
let event = DeviceActivityEvent(applications: socialActivitySelection.applicationTokens, categories: socialActivitySelection.categoryTokens, webDomains: socialActivitySelection.webDomainTokens, threshold: DateComponents(minute: 2))
let events: [DeviceActivityEvent.Name: DeviceActivityEvent] = [.socialScreenTimeEvent : event]
do {
activityCenter.stopMonitoring([.socialScreenTime])
/// Tries to start monitoring the activity using the specified schedule and events.
try activityCenter.startMonitoring(.socialScreenTime, during: schedule, events: events)
} catch {
/// Prints an error message if the activity could not be started.
print("Could not start monitoring: \(error)")
}
}
If there are any known workarounds or potential solutions, please share them.
Thank you for your help in resolving this problem.
When I tap on one of the buttons in the ShieldAction extension I want to close the shield and open the parent app instead of the shielded app. Is there any way of doing this using the Screen Time API?
class ShieldActionExtension: ShieldActionDelegate {
override func handle(action: ShieldAction, for application: ApplicationToken, completionHandler: @escaping (ShieldActionResponse) -> Void) {
// Handle the action as needed.
let store = ManagedSettingsStore()
switch action {
case .primaryButtonPressed:
//TODO - open parent app
completionHandler(.defer)
case .secondaryButtonPressed:
//remove shield
store.shield.applications?.remove(application)
completionHandler(.defer)
@unknown default:
fatalError()
}
}
}
Topic:
App & System Services
SubTopic:
General
Tags:
Managed Settings
Family Controls
Device Activity
Screen Time
Hello! I am working on a screentime app and wondering if anyone has had success achieving reliable background shield application while using com.apple.ManagedSettingsUI.shield-configuration-service?
I recently switched from com.apple.deviceactivity.shield-configuration (which worked reliably but isn't accepted by TestFlight) and have not found any consistency getting shields to apply while the app is backgrounded.
I believe this is a known limitation of ManagedSettingsUI and want to know if there are successful workarounds or any specific patterns/timing that improve consistency?
Topic:
App & System Services
SubTopic:
General
Tags:
Extensions
Device Activity
Managed Settings
Screen Time
anyone has the same problem which is that your device activity extension ain't working even tho all the code work perfectly in the console, I setup it in the right way , tried to make schedule and it did the same exact thing when I tried to create usage threshold. anyone know the reason for this bug?
here is my extension code
import ManagedSettings
import FamilyControls
import Foundation
import OSLog
import UserNotifications
class MonitoringExtension: DeviceActivityMonitor {
private let defaults = UserDefaults(suiteName: "group.com.William.app")
private let logger = Logger(subsystem: "com.William.app", category: "MonitoringExtension")
override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) {
let activityRaw = activity.rawValue
logger.info("Limite atteinte: \(activityRaw)")
scheduleNotification(title: "Limite dépassée", body: "Tu as utilisé trop de temps sur \(activityRaw).")
guard let data = defaults?.data(forKey: "\(activityRaw)_selection"),
let selection = try? JSONDecoder().decode(FamilyActivitySelection.self, from: data) else {
logger.warning("Pas de sélection pour \(activityRaw)")
return
}
let store = ManagedSettingsStore() // ← LE SEUL QUI MARCHE
store.shield.applications = selection.applicationTokens
if !selection.categoryTokens.isEmpty {
store.shield.applicationCategories = .specific(selection.categoryTokens)
}
logger.info("BLOCAGE ACTIF via ManagedSettingsStore.default")
}
override func intervalDidEnd(for activity: DeviceActivityName) {
super.intervalDidEnd(for: activity)
let store = ManagedSettingsStore()
store.clearAllSettings() // ← Débloque à minuit
logger.info("Restrictions levées à la fin de l'intervalle")
}
private func scheduleNotification(title: String, body: String) {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) { granted, _ in
guard granted else { return }
let content = UNMutableNotificationContent()
content.title = title
content.body = body
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil)
UNUserNotificationCenter.current().add(request)
}
}
}
Our app uses a 24-hour DeviceActivityMonitor repeating schedule to send users notifications for every hour of screen time they spend on their phone per day. Notifications are sent from eventDidReachThreshold callbacks at 1, 2, 3, etc, hour thresholds to keep them aware of their screen time.
We have recently received an influx of emails from our users that after updating to iOS 17.6.1 their DeviceActivityMonitor notifications are saying their screen time was much higher than what is shown in DeviceActivityReport and their device's Screen Time settings.
These users have disabled "Share Across Devices" - but I suspect the DeviceActivityMonitor is still getting screen time from their other devices even though that setting is turned off.
Has anybody else noticed this, understands what is causing this, or could recommend a fix that we can tell our users to do?
Hi!
For some reason my DeviceActivityReport sometimes fails to load. I've tried setting up a very simple mock views and displaying a report with a simple "Hello world" but even that won't work. It prints the following error message in the terminal but doesn't show anything else or any context as to what has gone wrong.
Failed to update the client's configuration: Error Domain=DeviceActivityReportService.ReportViewController.ClientError Code=2 "(null)"
It seems like the "makeConfiguration" method for the report isn't even being invoked. That may though just be an issue with printing messages in the extension.
Any help on what could be the issue, or even just a message that you're being the same thing would be greatly appreciated!
Pretty much as per the title and I suspect I know the answer. Given that Foundation Models run on device, is it possible to use Foundation Models framework inside of a DeviceActivityReport? I've been tinkering with it, and all I get is errors and "Sandbox restrictions". Am I missing something? Seems like a missed trick to utilise on device AI/ML with other frameworks.
I am still struggling to nail down the screen time between monitoring and showing it in a DeviceActivityReport. It's always off by a couple of percentage points, which results in a difference of a couple of minutes between the time shown for my total screen time in DeviceActivityReport and DeviceActivityMonitor with a threshold set for all apps/websites/categories.
In the report, I am looping through all segment (there is only 1 segement using .daily segment interval for a given day) then loop through all categories and all apps within each category and sum up all totalActivityDuration for each app. Based on avaiable documentation, that should corrolate to DeviceActivityMonitor threshold but it doesn't. Are there any differences in how these 2 places count screen time? Are there any apps/core ios services which are excluded from DeviceActivityMonitor. Would appreciate any help at all, I'm losing my mind here.
My current suspicion is that Apple Developer documentation is counted twice. i.e. this website https://developer.apple.com/documentation/deviceactivity/deviceactivitymonitor shows up in usage as an App with bundleId of apple.developer.wwdc-release and time spent there is counted twice, against this bundleId AND Safari. I don't know why it's not counted as a webdomain.
Hello everyone,
I’ve been stuck for weeks on an issue with Family Controls + Device Activity entitlements in my iOS app, and Apple Developer Support has not provided a solution so far. I’m hoping someone here who has successfully implemented Family Controls + Device Activity can point me in the right direction.
About the App
• The app is a Digital Wellbeing app called Breakloop.
• It lets users select apps they want to block, requires them to complete a positive affirmation before opening those apps, and can re-block apps after a set time (e.g., 10 minutes).
• This functionality exactly matches the purpose of Family Controls and Device Activity APIs.
What Works So Far
• Family Controls capability is enabled in the main app target in Xcode.
• We have valid Apple Developer certificates (Apple Development) and a team account.
• The main app builds and runs fine when using Family Controls alone.
• We have App IDs for:
• bl.Breakloop (main app)
• bl.Breakloop.BreakloopMonitorExtension
• bl.Breakloop.BreakloopShieldConfigurationExtension
The Problem
The provisioning profiles for the extension targets (BreakloopMonitorExtension and BreakloopShieldConfigurationExtension) do not include the com.apple.developer.device-activity entitlement even though:
• The App IDs in the Developer Portal have Family Controls (Development) enabled.
• The extensions have the correct entitlements file with both:
com.apple.developer.family-controls
com.apple.developer.device-activity
• Xcode Signing & Capabilities points to the correct provisioning profile + certificate.
Because the provisioning profiles don’t include the entitlement, the build fails with:
Provisioning profile doesn't include the com.apple.developer.device-activity entitlement.
What Apple Support Said
Apple Support told me:
• “Family Controls grants access to Device Activity.”
• They cannot enable it manually or guarantee that profiles will include the entitlement.
• They sent links to the documentation but no further assistance.
What I Need Help With
1. Has anyone successfully built extensions using Family Controls + Device Activity?
2. Do I need to request any additional approval for Device Activity, or should it appear automatically once Family Controls is enabled?
3. Is there a known Xcode or Apple Developer Portal configuration issue that causes the entitlement to be missing in provisioning profiles?
4. Any working example of a project setup that uses Family Controls + Device Activity in extensions would be extremely helpful.
Extra Info
• We use the latest Xcode + iOS SDK.
• Tried recreating certificates, profiles, and App IDs multiple times.
• Followed Apple’s docs for Family Controls + Device Activity exactly.
I would greatly appreciate any guidance, especially from someone who has this working with iOS app extensions.
Thank you!
Topic:
Code Signing
SubTopic:
Entitlements
Tags:
Entitlements
Family Controls
Device Activity
Screen Time
Hi, after updating to iOS 26 I'm encountering an issue where the FamilyActivityPicker no longer opens. No errors are shown in the console, it just never shows up. It works fine pre iOS 26. I've never had any issues with the picker showing up until iOS 26. My latest update was rejected because of this issue, but I've changed nothing in the code. Is anyone else experiencing this?
Topic:
App & System Services
SubTopic:
General
Tags:
Family Controls
Device Activity
Managed Settings
I started monitoring using the following code:
deviceActivityCenter.startMonitoring(
DeviceActivityName(name),
during: makeDailySchedule(),
events: events
)
Where:
DeviceActivitySchedule(
intervalStart: DateComponents(hour: 0, minute: 0),
intervalEnd: DateComponents(hour: 23, minute: 59),
repeats: true,
warningTime: nil
)
In DeviceActivityMonitor, I read and write data using UserDefaults and keep the logic minimal to ensure the size does not exceed 6MB.
However, after a period of time, monitoring continues to fail.
Why is this happening? How can I resolve this issue?
I'm working on an app for iOS that will help people get tasks done.
Within the app, we use a ManagedSettingsStore to let the user setup distracting apps. When the user opens any of those apps while it is being shielded, our ShieldConfiguration target opens and displays a screen that we configure with the description of the task they are supposed to do. On the bottom of the view, there are two buttons, one to start the task, and another to dismiss and return to their home screen.
I want to have the button that starts the task open up the main application and deeplink to the focus view with the task that they started. Currently, the only thing that we can tell the system to do is via a ShieldActionResponse which is an enum with 3 cases: none, close, or defer.
None of these three allow us to open the main application. I have found no workarounds that allow us to do it either. I've tried creating a custom URL scheme and calling UIApplication.shared.open(url), but there is no shared application available within the action extension. I have tried using a NSExtensionContext to open a url, but that does not work either. I have even tried starting a live activity to show the user what task they are working on and have a live timer, but that does not work either.
I know it is technically possible, because an app I downloaded does it perfectly. The app is called "Ascent: Screen Time Control". Is there some sort of extension I am missing, or entitlement I have not requested? Any help would be very appreciated.
Topic:
App & System Services
SubTopic:
General
Tags:
Family Controls
Device Activity
Managed Settings
Screen Time
Hello,
I have noticed that the ShieldConfiguration is only requested when opening a target app, and never when the application token is moved to a different shield while the target app remains in foreground.
This causes problems because many times the wrong ShieldConfiguration is displayed (recycled) instead of requesting a new ShieldConfiguration.
This bug has been around since the introduction of the Screen Time API in 2020 and is has not been addressed.
Bug reports:
FB14237883
FB17902392
Please fix asap!! Not acceptable to have bugs not being addressed for more than 5 years.
Most concerning: This is still reproducing on iOS 26 beta 7!!
Thanks a lot for your help.
Topic:
App & System Services
SubTopic:
General
Tags:
Family Controls
Device Activity
Managed Settings
Screen Time
As discussed and acknowledged here, there is a known bug with the FamilyActivityPicker. When a user expands a category that contains enough tokens to exceed the 50mb memory limit, the FamilyActivityPicker crashes.
This happens quite frequently for heavy Safari users. An apple engineer mentioned on this thread that WebDomains shown in the picker are present based on the last 30 days of usage data as surfaced by WebKit.
Is there any way a user can clear these WebDomains? Either programatically through our app or any other process we can guide them to as a workaround while this issue is getting fixed?
Topic:
App & System Services
SubTopic:
General
Tags:
WebKit
Family Controls
Device Activity
Screen Time
Hello, I am trying to display basic screen time data on my main screen. On the initial load of the screen, the DeviceActivityReport renders correctly and visible, but after being in the background and coming back to the app, the whole view is just blank. I don't think I'm doing anything special. Is this a known bug?
@main
struct MyActivityReportExtension: DeviceActivityReportExtension {
var body: some DeviceActivityReportScene {
// Create a report for each DeviceActivityReport.Context that your app supports.
TotalActivityReport { totalActivity in
TotalActivityView(totalActivity: totalActivity)
}
// Add more reports here...
}
}
extension DeviceActivityReport.Context {
// If your app initializes a DeviceActivityReport with this context, then the system will use
// your extension's corresponding DeviceActivityReportScene to render the contents of the
// report.
static let totalActivity = Self("Total Activity")
}
struct TotalActivityReport: DeviceActivityReportScene {
// Define which context your scene will represent.
let context: DeviceActivityReport.Context = .totalActivity
// Define the custom configuration and the resulting view for this report.
let content: (String) -> TotalActivityView
func makeConfiguration(representing data: DeviceActivityResults<DeviceActivityData>) async -> String {
// Reformat the data into a configuration that can be used to create
// the report's view.
let formatter = DateComponentsFormatter()
formatter.allowedUnits = [.day, .hour, .minute]
formatter.unitsStyle = .abbreviated
formatter.zeroFormattingBehavior = .dropAll
let totalActivityDuration = await data.flatMap { $0.activitySegments }.reduce(0, {
$0 + $1.totalActivityDuration
})
return formatter.string(from: totalActivityDuration) ?? "No activity data"
}
}
struct TotalActivityView: View {
let totalActivity: String
var body: some View {
VStack(alignment: .center, spacing: 4) {
Text("Screen Time")
.font(.system(size: 14, weight: .regular))
.foregroundColor(.secondary)
.frame(maxWidth: .infinity, // stretch to the full cell width
alignment: .center)
Text(totalActivity)
.font(.system(size: 18, weight: .medium))
.foregroundColor(.primary)
}
}
}
And I am using it in my main view:
private var analyticsSection: some View {
HStack(spacing: 24) {
// Some View
DeviceActivityReport(DeviceActivityReport.Context(rawValue: "Total Activity"), filter: DeviceActivityFilter(
segment: .weekly(
during: Calendar.current.dateInterval(
of: .weekOfYear, for: .now
)!
),
users: .all,
devices: .init([.iPhone, .iPad]),
))
.frame(maxWidth: .infinity)
// another view
}
.frame(maxWidth: .infinity, maxHeight: showAnalytics ? 58 : 0)
.padding(.horizontal, showAnalytics ? 24 : 0)
.opacity(showAnalytics ? 1.0 : 0.0)
.clipped()
}
Hello everyone,
I'm hoping to find a solution for a critical issue that is blocking my app's submission to the App Store.
My app uses the Screen Time API and therefore has a main app and a DeviceActivityMonitor extension.
The main app has been successfully granted the Family Controls (Distribution) entitlement. However, the DeviceActivityMonitor extension is stuck with only the Family Controls (Development) entitlement.
This mismatch causes my build to fail during the archive/distribution process with the error:
"Provisioning profile failed qualification. Profile doesn't support Family Controls (Development)."
This is a hard blocker, as the extension is a mandatory part of the API. I have already filled out the entitlement request form and also contacted Developer Support (Case #102666581576), who confirmed they could not assist and directed me here.
My question is:
What is the correct procedure to escalate or resolve the issue of a required extension not receiving the distribution-level Family Controls entitlement after the main app has already been approved?
Has anyone else encountered this specific "Development" vs. "Distribution" mismatch and found a definitive way to resolve it? Any guidance would be greatly appreciated.
Thank you!