Screen Time

RSS for tag

Share and manage web-usage data, and observe changes made to Screen Time settings by a parent or guardian.

Posts under Screen Time tag

143 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

iOS 26 regression: `DeviceActivityEvent`: `eventDidReachThreshold` called immediately (instead of waiting till threshold is reached)
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
0
0
138
1d
Shielding all apps
I am trying to create an app that allows users to opt in and apply a shield to all of their apps during a specified amount of time each day, but they can always turn the shield off from our app or directly ignore the shield for 1 minute from a shield button. It is important that the user doesn't choose what apps to apply a shield to through the activity picker, as some users might not apply it to all apps. Currently I am doing everything I described in my app and shield all apps and webdomain categories with this: store.shield.applicationCategories = .all() store.shield.webDomainCategories = .all() But the, store.shield.applicationCategories = .all(), seems to block everything except for some system apps like Messages, Phone, FaceTime, Maps, Clock, Settings, Safari, Find My, Clock, Compass, Health, etc. It does block some system apps like Weather, Photos, Camera, Measure, App Store, etc. I know I can fully block applications from it's bundle identifier but I do not want to remove apps from the home screen. I only want to apply a shield to all of them. I have read every apple documentation possible about this and can't see a way to do it, currently how I am doing it seems to be the best way but it is still not enough. Even blocking a specific category token taken from the activity picker won't apply to some system level applications under it unless you get all the application tokens and apply the shield by applications and not category. I am really looking for help to see if there is something I can do to achieve my app's goal.
0
0
60
2d
Open Parent App From ShieldActionDelegate
Hello, I’m building an app that helps people spend less time on social media apps. For that, I make heavy use of Apple’s Screen Time APIs, such as ManagedSettings and FamilyControls. When an app is locked using a ShieldConfiguration, the user has to open my app in order to unlock it (e.g. enter a code). This is very cumbersome because no documented API exists to open the parent app (=my app) from the ShieldActionDelegate (also part of my app) when the user presses a button of the ShieldConfiguration. The ShieldActionDelegate callback just offers three options in its ShieldActionResponse: .none .defer .close .openParentApp is missing. We are working around this limitation by sending a local push notification that the user has to tap on. This has multiple drawbacks: It has to be ensured that notification permission has been granted. It has to be ensured that notifications can be delivered even while focus is enabled. Features such as Apple Intelligence notification summaries and notification prioritization can heavily delay delivering notifications and thus frustrate the user. Neither my users nor myself do understand why this is not possible in a smoother way, at least according to the documentation. There are 3rd party apps that have such functionality, they can directly open their own app from a button press in the Shield, see here: https://apps.apple.com/us/app/applocker-passcode-lock-apps/id1132845904 It would be great if Apple could level the playfield for all developers and document how this is achievable, because technically it clearly is. Thanks a lot and have a great day!
4
1
160
4d
Detecting When App Token Is Removed Due to Category Selection in FamilyActivityPicker
I'm working with the Screen Time API (FamilyActivityPicker) in SwiftUI and need help with a specific scenario. I'm using the FamilyActivityPicker to let users select apps and categories to block. I save the previous selection (both applicationTokens and categoryTokens) locally. When the user updates their selection, I compare the new selection with the saved one to determine which apps or categories were removed. However, I’m trying to handle a specific case: when an individual app token is removed from the selection because its entire category was selected instead. In this situation, even though the app is no longer in applicationTokens, it's still blocked due to its category being included in categoryTokens. Since I need to show users which apps were actually removed, I want to avoid listing apps that are still indirectly blocked via a selected category. I’ve created a mapping between ApplicationToken and FamilyActivityCategoryToken to check whether a removed app is still covered by a selected category before displaying it. Is there any way to check this using the current Screen Time APIs, or does the system not give access to the relationship between apps and their categories? Any help or suggestions would mean a lot!
2
1
118
5d
FamilyControls Framework Not Working for TestFlight Testers
Hello everyone, I’m developing an app using the FamilyControls framework, I distributed through TestFlight the other day using the “Family Controls” distribution (not Development). Everything works as expected in dev builds — but for external TestFlight testers, nothing in the FamilyControls framework seems to function. I'm using the correct Family Controls capability in Xcode (added via Signing & Capabilities). The com.apple.developer.family-controls entitlement is present in my .entitlements file. All the users who reported the issue had correctly given screen time permissions to the app. Would really appreciate some help regarding where the issue could come from.
1
0
104
5d
Bug in Screen Time API: familyActivityPicker dismisses a presenting sheet on iOS 18.4 and above
Hello, I’m presenting the familyActivityPicker from a presented sheet in my application. When I select some apps, categories or websites and tap “Done”, the familyActivityPicker is dismissed but the presenting sheet is also dismissed on iOS 18.4, iOS 18.5, iOS 26 beta 1 and 2. If I tap on “Cancel” from the familyActivityPicker, the sheet is also dismissed on iOS 18.4, iOS 18.5, iOS 26 beta 1 and 2. The same code works perfectly fine on iOS 18.0, iOS 18.1, iOS 18.2 and iOS 18.3. Is this a known-issue? If opened the feedback FB18369821 for this. Regards, Axel
2
0
54
4d
Can FamilyControls ApplicationToken or CategoryToken expire? If yes, how to detect and handle it?
How to programmatically check if ApplicationToken or ActivityCategoryToken is expired in FamilyActivityPicker? I'm building a Screen Time-based parental control app using FamilyControls and ManagedSettings. We use FamilyActivityPicker to allow the user to select apps and categories to restrict, and we apply the shield using: store.shield.applications = .specific(selection.applicationTokens) store.shield.applicationCategories = .specific(selection.categoryTokens) Sometimes, we observe that the shield silently fails to apply — no error is thrown, but the restrictions aren't enforced. I suspect this may be due to expired or invalid tokens, possibly if the app was removed or the selection became stale. My Questions: Can ApplicationToken or ActivityCategoryToken expire or become invalid over time? If yes, is there a supported or recommended way to detect whether a token is still valid before applying it to the shield? Is comparing the current shield values (store.shield.applications and store.shield.applicationCategories) after applying them a reliable validation method? What's the best practice to handle expired tokens (e.g. re-prompt the FamilyActivityPicker, or show a fallback)? What Is the Expiration Duration of Tokens from FamilyActivityPicker? Any guidance or insight from the Screen Time/FamilyControls team would be greatly appreciated! Thank you!
1
2
59
3w
Family Controls App Help
Hello! I am a relatively new Apple developer and am almost done with my first app. I am implementing the Screen Time API to my app because the app is designed to help the user digitally detox and I am trying to make it so the user can select which apps they would like to monitor from a list of their apps on their phone so I am using the family activity picker but I just can't extract the data needed to track the apps. I am wondering how to do this. Thank you!
1
0
66
4d
How can I access Screen Time data in my app? (Individual vs. Enterprise Program)
Hello, I would like to retrieve Screen Time data in my iOS app for development purposes. I have read that access to Screen Time data may be possible if you are enrolled in the Apple Developer Program as an organization (enterprise membership), but not as an individual developer. Could anyone clarify the following points? Is it possible to access Screen Time data via API or framework as an individual developer? Is this functionality limited only to enterprise members, and if so, what are the requirements or procedures? Are there any official Apple documents or sample codes about this process? If anyone has experience or can share relevant links or advice, I would really appreciate it. Thank you in advance!
1
0
85
Jun ’25
ShieldConfigurationExtension & SwiftData
Hi, I am developing a Screen Time App and I am having issues with the ShieldConfigurationExtension (ShieldConfigurationDataSource). I know this extensions is sandboxed but I should be able to read data from the main app. I am using SwiftData as my database, but I am unable to initialize it in the extensions with an error indicating insufficient file permissions. I have App Group set up and I am able to share data using UserDefaults but that is just inconvenient. Is there any way I could just open the SwiftData in read only mode so that I could display the user some info on the shield? SwiftData Init: private func setupContainer() throws { let schema = Schema([ DogEntity.self, HouseEntity.self ]) // Use app group container if available let config: ModelConfiguration if let containerURL = FileManager.default.containerURL( forSecurityApplicationGroupIdentifier: "group.\(Bundle.app.bundleIdentifier ?? "")" ) { config = ModelConfiguration(schema: schema, url: containerURL.appendingPathComponent("default.sqlite")) } else { config = ModelConfiguration(schema: schema) } self.container = try ModelContainer(for: schema, configurations: [config]) } Error in extension: fault: Attempt to add read-only file at path file:///private/var/mobile/Containers/Shared/AppGroup/51431199-5919-4AE6-940C-6FE3C53EEB46/default.sqlite read/write. Adding it read-only instead. This will be a hard error in the future; you must specify the NSReadOnlyPersistentStoreOption. error: (3) access permission denied error: Encountered exception error during prepareSQL for SQL string 'SELECT TBL_NAME FROM SQLITE_MASTER WHERE TBL_NAME = 'Z_METADATA'' : access permission denied with userInfo { NSFilePath = "/private/var/mobile/Containers/Shared/AppGroup/51431199-5919-4AE6-940C-6FE3C53EEB46/default.sqlite"; NSSQLiteErrorDomain = 3; } while checking table name from store: <NSSQLiteConnection: 0x154100300> error: Store failed to load. <NSPersistentStoreDescription: 0x15402d590> (type: SQLite, url: file:///private/var/mobile/Containers/Shared/AppGroup/51431199-5919-4AE6-940C-6FE3C53EEB46/default.sqlite) with error = Error Domain=NSCocoaErrorDomain Code=256 "The file “default.sqlite” couldn’t be opened." UserInfo={NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/51431199-5919-4AE6-940C-6FE3C53EEB46/default.sqlite, NSSQLiteErrorDomain=3} with userInfo { NSFilePath = "/private/var/mobile/Containers/Shared/AppGroup/51431199-5919-4AE6-940C-6FE3C53EEB46/default.sqlite"; NSSQLiteErrorDomain = 3; } Any help appreciated 🙂
0
0
75
May ’25
DeviceActivityReport inside SwiftUI Button doesn’t receive tap gestures (ScreenTime API, iOS 17+)
Hi everyone, I’m experimenting with the new ScreenTime DeviceActivityReport view in SwiftUI (iOS 17 / Xcode 15). My goal is to show the report inside a Button (or, more generally, capture any tap on it) so that I can push a detail screen when the user selects it. Here’s the minimal code that reproduces the issue: import FamilyControls import DeviceActivity import SwiftUI struct ScreenTimeView: View { let center = AuthorizationCenter.shared @State private var context: DeviceActivityReport.Context = .init(rawValue: "Total Activity") @State private var filter = DeviceActivityFilter( segment: .hourly( during: Calendar.current.dateInterval(of: .day, for: .now)! ), users: .all, devices: .init([.iPhone, .iPad]) ) var body: some View { ZStack { DeviceActivityReport(context, filter: filter) } .onAppear { Task { do { try await center.requestAuthorization(for: .individual) } catch { print("Authorization failed:", error) } } } } } struct ContentView: View { var body: some View { ScrollViewReader { _ in ScrollView(showsIndicators: false) { VStack { Button { print("BUTTON TAPPED") // ← never fires } label: { ScreenTimeView() .frame(height: UIScreen.main.bounds.height * 1.4) } } } } } } ** What happens** DeviceActivityReport renders correctly with hourly bars. Tapping anywhere inside the Button does not trigger print("BUTTON TAPPED"). I’ve tried replacing Button with .onTapGesture, adding .contentShape(Rectangle()), and .allowsHitTesting(true), but nothing registers. What I’ve checked Authorisation succeeds—calling code in .onAppear prints no errors. Removing DeviceActivityReport and replacing it with a plain Rectangle() lets the tap gesture fire, so the issue seems specific to DeviceActivityReport.
1
0
88
4d
Screen Time API: How to map bundleIdentifier to ApplicationToken for DeviceActivityMonitor when FamilyActivitySelection.Application.bundleIdentifier is nil?
I'm using FamilyActivityPicker to get consent for app/category management, which returns a FamilyActivitySelection object. I serialize this FamilyActivitySelection object (just applicationTokens and categoryTokens) and pass it to my DeviceActivityMonitor extension via App Group UserDefaults. I am using the JSON encoder/decoder over PropertyList (though both seem to exhibit the same behavior). After inspecting the FamilyActivitySelection object immediately after it's returned by FamilyActivityPicker in the main app, the application.bundleIdentifier property is consistently nil for every Application object within selection.applications. Similarly, category.localizedDisplayName is nil for ActivityCategory objects. This happens whether "Select All Apps" is used or if apps/categories are selected individually. I understand that this is the intended behavior due to Apple's user privacy policies. I read on another post that my app can be provided with bundle identifiers and app names within Shield Configuration extensions and Device Activity Report extensions - I'm not sure which ones or how exactly to do this. I am aware that I can use Label(applicationToken) SwiftUI view to display the app name/icon, but this doesn't give programmatic access to the bundleIdentifier string. My app will not log or export these bundleIdentifiers outside of its sandbox. My goal is to create mappings to the FamilyActivitySelection with the publicly accessible bundleIdentifiers. Any guidance, examples, or clarification on the intended workflow for this scenario would be greatly appreciated!
0
0
90
May ’25
FamilyActivityTitleView Label has wrong text color when app is using different than system theme
Hello, In a new app I am working on I noticed the FamilyActivityTitleView that displays "ApplicationToken" has wrong (black) color when phone is set to light mode but app is using dark mode via override. We display user's selected apps and the labels are rendered correctly at first, but then when user updates selection with FamilyActivityPicker, then those newly added apps are rendered with black titles. The problem goes away when I close the screen and open it again. It also doesn't happen when phone is set to dark theme. I am currently noticing the issue on iOS 18.4.1. I have tried various workarounds like forcing white text in the custom label style, forcing re-render with custom .id value but nothing helped. Is there any way how to fix this?
0
0
55
May ’25
Clarification on ManagedSettings Shield Precedence (Application vs. Category)
I'm encountering what appears to be a specific precedence behavior with ManagedSettingsStore.shield and would appreciate some further clarification. My current understanding is that category-level shields take precedence over individual app allowances. My test involved... Using FamilyActivityPicker to select a single target application (e.g., "Calculator," which falls under the "Utilities" category). Using FamilyActivityPicker again to select the category of that target application. I applied shields using ManagedSettingsStore (named .individual): store.shield.applicationCategories = .specific(Set([utilitiesCategoryToken])) store.shield.applications = Set([calculatorApplicationToken]) Result: The calculator app remains shielded, suggesting that the category-level shield on Utilities overrides the attempt to allow the individual app. I also tried this using a single picker, but received only the category token instead of all application tokens in that category. Is this observed precedence (where store.shield.applicationCategories effectively overrides store.shield.applications for apps within the shielded category) the intended behavior? If so, are there any mechanisms available within the main app's capabilities (potentially using a Device Activity Report Extension or Shield Extension) to allow a specific ApplicationToken if its corresponding ActivityCategoryToken is part of the store.shield.applicationCategories set? Essentially, can store.shield.applications be used to create "allow exceptions" for individual apps that fall into an otherwise shielded category? Additionally, I mentioned that selecting an entire category in the picker only returns the opaque category token, not any application tokens. Is there any way in which I could return both the category and all application tokens by just selecting the category? Any insights or pointers would be greatly appreciated!
0
0
74
May ’25
Apps remain blocked after being unselected
Hi everyone, We're using the react-native-device-activity package to implement app blocking via Apple's Screen Time API. The blocking functionality works well: when the user selects apps and taps "Done," those apps get blocked as expected. However, we're facing an issue with unblocking apps that the user later unselects. Even after the user unchecks some apps and taps "Done" again, those previously selected (now unselected) apps remain blocked and still show the shield.
0
0
62
May ’25
Issue with Universal Links and App Extension (ShieldAction Handler)
Issue with Universal Links and App Extension (ShieldAction Handler) I'm currently working on a POC app using the FamilyControls framework and facing an issue when trying to open a Universal Link from an app extension, specifically from a ShieldAction handler. When I try to open a Universal Link, I encounter the following error: Failed to open URL https://sixteen-server-c008110f8759.herokuapp.com/.well-known/apple-app-site-association: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open 'com.apple.mobilesafari' failed." UserInfo={BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x14f2d90b0 {Error Domain=FBSOpenApplicationErrorDomain Code=3 "Application com.sixteen.life is neither visible nor entitled, so may not perform un-trusted user actions." UserInfo={BSErrorCodeDescription=Security, NSLocalizedFailureReason=Application com.sixteen.life is neither visible nor entitled, so may not perform un-trusted user actions.}} Context: I’m using a ShieldAction handler as part of an App Extension to trigger the action (e.g., "Break in Shield") in my app. The app extension (ShieldAction handler) is responsible for trying to open the Universal Link. I’m encountering the error because the app is not visible or entitled to perform this action, which seems to be related to security restrictions when using App Extensions. Questions: App Extension and Universal Link Interaction: Is it possible for an App Extension (like ShieldAction handler) to open a Universal Link or trigger an external app, such as Safari, even though it is not the foreground app? Entitlements for App Extensions: Are there any specific entitlements or permissions required to allow an app extension (ShieldAction handler) to open Universal Links or perform actions like opening Safari from the background? App Visibility and State: How can I ensure that my app is in the right state (visible/active) and has the necessary entitlements to trigger these actions when running in the context of an app extension? Workaround: If this behavior is restricted due to app extension limitations, what would be the recommended workaround to handle launching external apps (like Safari) or Universal Links from within an app extension?
9
0
203
4d
ScreenTime: Block the Messages, Phone, Camera apps
I want to limit my child's phone usage at night by allowing them to scan a QR code to enforce app limitations via ScreenTime. When they scan the QR code, I'm still unable to prevent them from accessing the Phone, Messages, and Camera app via ScreenTime. Is there a way I can block or heavily restrict their access to these three apps via ScreenTime? How do I prevent my child from undoing or evading the ScreenTime enforcement I'm trying to enforce?
1
0
65
May ’25
How does an app like Jomo access Screen Time data on parent devices (not just child devices)?
Hi all, I'm working on a Screen Time-based app with gamification features for families, where both children and parents interact and compare usage stats. The endgoal of the app is to motivate for less screentime or more use of productive apps. I'm testing Apple's Family Controls API, which works great for getting data from child devices. However, this API doesn't support fetching screen time data on the parent device itself. Apps like Jomo appear to provide insights and even their own "calculations" on screen time usage directly on the parent device. I have tested a few apps that showed both the usage data for my children and myself and did some nice things with it like creating stats. I've gone through the documentation and APIs extensively, but I can’t figure out how they’re doing this. As far as I can tell the only solution would be a custom VPN or MDM. However as far as I can tell Jomo for example does not use either of those. My questions are: Am I missing some API Are apps like Jomo using private APIs which they have been granted access to from Apple? Is there any way to access similar data on a parent device without using MDM or VPN? Any guidance or clarification would be greatly appreciated!
1
0
89
May ’25
Reshield apps after certain time?
So I have been working with the screen time api. however I still cant get it to work to reshield certain apps after a certain time because for example Dispatch Queue just gets terminated after a certain time. This is my code right now but the reshielding doesn't get called. Please help I have been working on this since weeks and weeks. import ManagedSettings import DeviceActivity import Foundation class ShieldActionExtension: ShieldActionDelegate { let store = ManagedSettingsStore() let center = DeviceActivityCenter() override func handle(action: ShieldAction, for application: ApplicationToken, completionHandler: @escaping (ShieldActionResponse) -> Void) { switch action { case .primaryButtonPressed: // Unshield the app store.shield.applications?.remove(application) // Encode and persist ApplicationToken if let encoded = try? PropertyListEncoder().encode([application]) { UserDefaults(suiteName: "group.Organization.BrainRipe.cmonnow")?.set(encoded, forKey: "StoredApplicationTokens") } let unshieldDurationMinutes = 2 let now = Date() guard let endDate = Calendar.current.date(byAdding: .minute, value: unshieldDurationMinutes, to: now) else { completionHandler(.close) return } let activityName = DeviceActivityName("com.myapp.shield.reapply") let schedule = DeviceActivitySchedule( intervalStart: Calendar.current.dateComponents([.hour, .minute], from: now), intervalEnd: Calendar.current.dateComponents([.hour, .minute], from: endDate), repeats: false ) do { try center.startMonitoring(activityName, during: schedule) } catch { print("Error starting monitoring: \(error)") } completionHandler(.close) case .secondaryButtonPressed: completionHandler(.defer) @unknown default: fatalError("Unhandled ShieldAction case.") } } } import DeviceActivity import ManagedSettings import Foundation // Optionally override any of the functions below. // Make sure that your class name matches the NSExtensionPrincipalClass in your Info.plist. class DeviceActivityMonitorExtension: DeviceActivityMonitor { let store = ManagedSettingsStore() override func intervalDidStart(for activity: DeviceActivityName) { super.intervalDidStart(for: activity) // Handle the start of the interval. } override func intervalDidEnd(for activity: DeviceActivityName) { guard let data = UserDefaults(suiteName: "group.Organization.BrainRipe.cmonnow")?.data(forKey: "StoredApplicationTokens"), let tokens = try? PropertyListDecoder().decode([ApplicationToken].self, from: data) else { return } let tokenSet = Set(tokens) if store.shield.applications == nil { store.shield.applications = tokenSet } else { store.shield.applications?.formUnion(tokenSet) } // Clear tokens after use UserDefaults(suiteName: "group.Organization.BrainRipe.cmonnow")?.removeObject(forKey: "StoredApplicationTokens") } }
1
0
92
May ’25